Kod
<?php
$connect = mysql_connect("localhost", "root", "")
or die(mysql_error());
mysql_select_db("moviesite");
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;
}
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;
}
echo"<table border = '1'>\n";
echo"<tr>\n";
echo"<td><strong>Tytuł</strong></td>";
echo"<td>głowny aktor</td>";
echo"<td>Reżyser</td>";
echo"</tr>";
$query = "SELECT * FROM movie";
$results = mysql_query($query) or die(mysql_error());
while ($rows=mysql_fetch_assoc($results)) {
extract ($rows);
get_leadactor($movie_leadactor);
get_director($movie_director);
echo "<tr>\n";
echo"<td>\n";
echo"<td>";
echo $actorname;
echo"</td>\n";
echo"<td>\n";
echo $director;
echo"</td>\n";
echo"</tr>\n";
}
echo"</table>";
?>
$connect = mysql_connect("localhost", "root", "")
or die(mysql_error());
mysql_select_db("moviesite");
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;
}
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;
}
echo"<table border = '1'>\n";
echo"<tr>\n";
echo"<td><strong>Tytuł</strong></td>";
echo"<td>głowny aktor</td>";
echo"<td>Reżyser</td>";
echo"</tr>";
$query = "SELECT * FROM movie";
$results = mysql_query($query) or die(mysql_error());
while ($rows=mysql_fetch_assoc($results)) {
extract ($rows);
get_leadactor($movie_leadactor);
get_director($movie_director);
echo "<tr>\n";
echo"<td>\n";
echo"<td>";
echo $actorname;
echo"</td>\n";
echo"<td>\n";
echo $director;
echo"</td>\n";
echo"</tr>\n";
}
echo"</table>";
?>
błąd wygląda następująco :
Kod
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 13
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 13
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 24
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 13
Tytuł głowny aktor Reżyser
Może wy znajdziecie przyczynę.
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 13
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 24
Warning: extract() [function.extract]: First argument should be an array in D:\serwer\WebServ\httpd-users\corran\strpmlo\baza1.php on line 13
Tytuł głowny aktor Reżyser