Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [PHP]Problem z kodem
corran_horn
post 13.08.2009, 18:22:21
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 28.12.2006

Ostrzeżenie: (0%)
-----


teoretycznie kod powinien działać, ale wyrzuca bład oto kod:
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>";
?>

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ę.
Go to the top of the page
+Quote Post
Spawnm
post 13.08.2009, 18:25:11
Post #2





Grupa: Moderatorzy
Postów: 4 069
Pomógł: 497
Dołączył: 11.05.2007
Skąd: Warszawa




Tytuł bez sensu, złe BBcode, forum nie parser.
Zamykam.
Go to the top of the page
+Quote Post

Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 12:06