i am new in php .please i need help in correcting the error in this code which prints names from the database. on running the code it gives the message extract expect parameter 1 to be array but boolean given
<?php
//connect to MySQL
$connect = mysql_connect("localhost","root","password") or die ("Hey loser, check your server connection.");
//make sure we’re using the right database
mysql_select_db("moviesite");
//create function to get lead actor
function get_leadactor($lead_actor){
global $actorname;
$query2 = "SELECT people_fullname ".
"FROM people ".
"where people.people_id = $lead_actor ";
$results = mysql_query($query2) or die(mysql_error());
$rows = mysql_fetch_array($results);
extract($rows);
$actorname = $people_fullname;
}
//create a function to get director
function get_director($director){
global $directorname;
$query2 = "SELECT people_fullname ".
"FROM people ".
"where people.people_id = $director ";
$results = mysql_query($query2) or die(mysql_error());
$rows = mysql_fetch_array($results);
extract($rows);
$directorname = $people_fullname;
}
//add a header row
echo"<table border=\"1\">\n";
echo "<tr>\n";
echo "<td><strong>Movie Name</strong></td>";
echo "<td><strong>Lead Actor</strong></td>";
echo "<td><strong>Director</strong></td>";
echo "</tr>";
//get the movies
$query="SELECT * FROM movie";
$results = mysql_query($query)
or die(mysql_error());
while ($rows = mysql_fetch_assoc($results)) {
extract($rows);
//call our functions to get specific info
get_leadactor($movie_leadactor);
get_director($movie_director);
//build the table
echo "<tr>\n";
echo "<td>\n";
echo $movie_name;
echo "</td>\n";
echo "<td>";
echo $actorname;
echo "</td>\n";
echo "<td>\n";
echo $directorname;
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
?>