Please help me understand this PHP script.Noob here

Posted by NissGTR on Stack Overflow See other posts from Stack Overflow or by NissGTR
Published on 2011-11-12T06:13:59Z Indexed on 2011/11/12 9:50 UTC
Read the original article Hit count: 178

I'm learning PHP,MySQL and came across this function today

function get_director($director_id) {
global $db;
$query = 'SELECT 
        people_fullname 
   FROM
       people
   WHERE
       people_id = ' . $director_id;
$result = mysql_query($query, $db) or die(mysql_error($db));

$row = mysql_fetch_assoc($result);
extract($row);

return $people_fullname;
}

I understand what functions are and I've created a few while learning PHP.But this one is a bit more complicated.I can't understand the

WHERE people_id = ' . $director_id

I'm new to MySQL.I guess the single quote ends the MySQL statement?And then it is concatenated with the argument? Please help me out.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql