Page 1 of 3
I should have an interview for coding PHP soon, hopefully.
Posted: Thu Sep 21, 2006 12:44 pm
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

Posted: Thu Sep 21, 2006 12:55 pm
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!
Posted: Thu Sep 21, 2006 1:06 pm
by daedalus__
grood job (both of ya)
Posted: Thu Sep 21, 2006 1:24 pm
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.
Posted: Thu Sep 21, 2006 1:27 pm
by Burrito
awesome man...congrats!
Re: I should have an interview for coding PHP soon, hopefull
Posted: Thu Sep 21, 2006 2:21 pm
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.
Posted: Thu Sep 21, 2006 2:27 pm
by RobertGonzalez
Good job impulse(). And good luck. I hope you get it.
Posted: Thu Sep 21, 2006 2:29 pm
by Luke
you guys should note that my original script was actually wrong and I wouldn't have got the job haha
<--loser
Posted: Thu Sep 21, 2006 3:01 pm
by RobertGonzalez
We know you're a lo... nevermind. I shouldn't...
Posted: Thu Sep 21, 2006 3:08 pm
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 
Posted: Thu Sep 21, 2006 4:23 pm
by toasty2
Or even worse....You're a poop.
Posted: Thu Sep 21, 2006 4:24 pm
by Obadiah
lol
Posted: Thu Sep 21, 2006 4:27 pm
by feyd
That's enough off topic nonsense.
Posted: Fri Sep 22, 2006 6:39 am
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,
Posted: Fri Sep 22, 2006 6:44 am
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