Fog Creek Software
Discussion Board




PHP/MySQL interview questions?

I am going to an interview soon for a PHP and MySQL programming position.  Does anyone know what kind of programming questions or puzzles I need to look out for?  I am in desparate need for this job and appreciate any help you can offer.  Thanks.

Conor MacLeod
Friday, April 30, 2004

I don't have much to offer on the question itself.  I must say that if you are qualified for the job, then you won't have any problems answering the questions.  If you aren't qualified, then you probably don't want a job that you will fail at.  And whether or not you get the puzzle/question completely right isn't what anyone is looking for, they're looking for how you approach the question and make an effort to arrive at a solution.

I guess if they ask you "why do you want to work for company X" and you answer "I don't" then you probably go that one wrong, but otherwise, just relax, be yourself, and do your best.  It's all you can expect of you yourself.  Like I said, if you're qualified, you'll do fine.  (Note: being qualified and doing fine doesn't necessarily mean you will get the job, because there could always be someone that is more qualified waiting around the corner that you are unaware of.)

Elephant
Friday, April 30, 2004

I interviewed someone for a similar position.  Based on a couple of discussions here, I don't asked nit-picky PHP-specific questions.  I do ask "How do you prevent a SQL injection?"  I present some poorly designed database tables and ask what's wrong/right.  I asked how they'd approach a new project (looking for requirements, user interviews, design methodlogy, etc).  I usually quiz on what they put on their resume to make sure they aren't just making stuff up.  Sometimes I'll give them some code and ask what they think.  A lot will depend on the specifics of the position.

Infinite Monkeys
Friday, April 30, 2004

What's an SQL injection?

Bob
Friday, April 30, 2004

SQL Injection is when form data contains an SQL escape sequence and injects a new SQL query to be run.

MyNameIsSecret();
Friday, April 30, 2004

If you know enough about PHP/MySQL to feel comfortable applying fo the job, I would guess you shouldn't worry too much about the technical side of the interview.  My take on it is that as long as you have a good foundation of programming concepts and prinicpals (i.e. functions, variables, classes/objects etc.) then you could be trained to acclamate to twhatever coding style their team uses without too much trouble.

I think the typical interview would only go about verifying that you are not lying about your credentials on your resume, and then the rest of the interview is basically to figure out if your personality and character is a good fit for their team.  That is why I would agree with the above poster who said to be yourself.  I know its hard, but try to psyche yourself up to believing you don't *need* the job, you just *want* it.

Clay Whipkey
Friday, April 30, 2004

Umm that SQL injection almost sounds lke a question I was once asked: if you call a function and you set a variable in that function will the value for that variable be available in your main section. And I really didn't know. I wish you'd cut my hands off if I ever wrote something like that. I wonder if SQL injections can happen if you do what everyone should do with data you cannot trust: validate it.  Perl has taint for this. You can't use tainted data to do certain things until you untaint it. From what I've seen of PHP, most such programmers just assume variables into existence and they don't use the PEAR DB.php but instead just sprinkle sql statements all over their code and I rarely see anyone validating their input.

But about the questions. I was once interviewed by a writer of an O'Reilly book.  He asked me a question. I thought for a second, and said gosh I didn't know. He said he didn't know either, that's why we have reference books.  You can't know everything.

If I interviewed you I'd want you to bring some code. I'd want to see some apps you wrote.  I wouldn't need to ask you any questions.  I once helped in hiring a person who had never worked as a programmer. He had a masters and had been going for his PhD in Math and he had samples of code he had written in java, perl, and javascript.  I could see from his code that he was neat, I liked that. imho he wrote too much but it showed he had some knowledge or could translate knowledge to reality. He was personable and serious. We hired him and he did a great job.

Often times the person interviewing you has no clue whatsoever. I'd be sure to check into the company. Why do they need someone? Do they already have programmers? Who are they? If they have a website take a look at it. Test their website and see if they have it fortified, how do they handle form errors? Try to use SQL injection or cross-site scripting et. That's what I'd do.

must remain anonymous
Friday, April 30, 2004

As what they like or don't like about PHP/MySQL, and why so. And how they would fix their deficiences. Always a good way to see if one knows his platform well.

Egor
Friday, April 30, 2004

I wasn't looking for any single response w/ my SQL injection question.  There's a couple of ways to solve it.  I want to know that they've run up against it and found some way of dealing with it.  I liked your answer BTW.

Infinite Monkeys
Friday, April 30, 2004

I was asked how to design a set of database tables that contained people, and musical genres, where each person could choose multiple genres. Just a simple many to many thing. Apparently I was the only candidate who could do that, so I got the job. Which probably says more about the quality of candidates in my city that anything.

Matthew Lock
Friday, April 30, 2004

*  Recent Topics

*  Fog Creek Home