This question already has an answer here:
I have written this function , but return $director_name
not working , my editor show This error : undefined Variable
function get_director($id){
global $db ;
$query ='
SELECT
director_name
FROM
movie_directors
WHERE
director_id = '.$id;
$result = mysql_query($query,$db) or die(mysql_error($db));
$row =mysql_fetch_assoc($result);
extract($row);
return $director_name;
}
and this is my php code
<?php
while($row = mysql_fetch_assoc($result)){
echo('<tr class="data">');
extract($row);
$director = $get_director($movie_director);
echo('<td>'.$movie_title.'</td>');
echo('<td>'.$movie_year.'</td>');
echo('<td class="director_field"><a href="#">'.$director.'</a></td>');
echo('<td>'.$movie_actor.'</td>');
echo('<td>'.$movie_genre.'</td>');
}
?>
PHP here show msg :Fatal error: Function name must be a string
please Help ME thanks.
</div>