I should have an interview for coding PHP soon, hopefully.

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

I should have an interview for coding PHP soon, hopefully.

Post by impulse() »

I work at a company doing technical support for xDSL, leased lines, email servers etc at the moment, which I hate. It's only the past month I've been learning PHP but I really love it. I asked the programming manager today what I'm expected to know to be considered for an interview and he asked me what I know, which is structure, loops, if statements, MySQL queries and he said he would try and set me up an interview. All I've gotta do in the interview is code a page that inserts data into a MySQL DB and I get 45 minutes to do that. Seems easy enough :)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

that's the only requirement?? Insert it in the database? that's not very hard... 2 lines...

Code: Select all

<?php
mysql_connect($host, $user, $pass);
mysql_select_db($db);
mysql_query("INSERT INTO table VALUES('crap')");
?>
I just got the job... and in less than one minute.

EDIT: I just realized I forgot to select the database... so maybe i didn't get the job haha I can't believe none of you caught that!! SHAME ON YOU GUYS!
Last edited by Luke on Thu Sep 21, 2006 2:26 pm, edited 2 times in total.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

grood job (both of ya)
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

I think it's more of a training job. Maintaining the companys partners site as they resell IT products and need a partner login to keep track of ADSL status etc.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

awesome man...congrats!
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: I should have an interview for coding PHP soon, hopefull

Post by onion2k »

impulse() wrote:All I've gotta do in the interview is code a page that inserts data into a MySQL DB and I get 45 minutes to do that.
Ask if they use a database abstraction library first. If not:
  • Connect to the database (handle errors if the database connection cannot be established)
  • Select a database (handle errors if the database isn't found)
  • Gather incoming data (use $_GET or $_POST)
  • Validate that required data is available (use isset(), empty(), is_numeric(), strlen(), regexp for email validation, etc)
  • Escape necessary string values (using mysql_real_escape_string(), might want to check get_magic_quotes_gpc() )
  • Build an insert SQL string (include field names, might be nice to use imploded arrays or associative arrays)
  • Run the query (handle insert errors)
  • Get the insert id (call mysql_insert_id() )
  • Close the connection nicely (mysql_close() )
  • Don't forget to comment your code
Sorted. The job is yours. 45 minutes is plenty of time.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Good job impulse(). And good luck. I hope you get it.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

you guys should note that my original script was actually wrong and I wouldn't have got the job haha
<--loser
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

We know you're a lo... nevermind. I shouldn't...
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

The Ninja Space Goat wrote:

Code: Select all

<?php
mysql_connect($host, $user, $pass);
mysql_select_db($db);
mysql_query("INSERT INTO table VALUES('crap')");
?>
you forgot to select the database....SMURFSLAP to ya...just for that ill call you the ultimate insult...POO POO HEAD!

i cheated :lol:
toasty2
Forum Contributor
Posts: 361
Joined: Wed Aug 03, 2005 10:28 am
Location: Arkansas, USA

Post by toasty2 »

Or even worse....You're a poop.
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

:cry:
lol
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That's enough off topic nonsense.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

Going back on topic - I've been told I wont be inserting into a DB anymore and it'll be a "surprise". What else could I be asked to do, baring in mind this is going to be basic stuff. I just don't want to screw this up so I want to have the resolution to every potential task. I can insert, update, delete, & sort a MySQL DB at the moment. What else might I be asked to do. What other basic functions are there in MySQL DBs?

Regards,
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

read up on string and date/time functions as they might come in handy... if all they gonna ask is from MySQL
Post Reply