
Skrypt ma wyświetlać tabelke z tytulami filmow, rok, gatunek i numerami ID aktorow / reżyserów z tabeli people.
Niestety wyswietla tylko informacje "W bazie danych znajduje sie 3 filmow" i górną cześć tabeli (nagłówek - Nazwa filmu, Rok produkcji itd) Danych brak.
<?php $query = "SELECT movie_name, movie_director, movie_leadactor " . "FROM movie"; $movie_header=<<<EOD <h2><center>Baza danych recenzji filmow</center></h2> <table width="70%" border="1" cellpading="2" cellspacing="2" align="center"> <tr> <th>Tytul filmu</th> <th>Rok produkcji</th> <th>Rezyser</th> <th>Glowny aktor</th> <th>Gatunek</th> </tr> EOD; $movie_details = ''; $movie_name = $row['movie_name']; $movie_director = $row['movie_director']; $movie_leadactor = $row['movie_leadactor']; $movie_detalis .=<<<EOD <tr> <td>$movie_name</td> <td>$movie_director</td> <td>$movie_leadactor</td> </tr> EOD; } $movie_detalis .=<<<EOD <tr> <td> </td> </tr> <tr> <td>Lacznie filmo: $num_movies</td> </tr> EOD; $movie_footer ="</table>"; $movie =<<<MOVIE $movie_header $movie_details $movie_footer MOVIE; ?>
tu struktura bazy
<?php //polaczenie z mysql //utworz baze danych //wybieramy nowa baze //utworz nowa tabele "movie" $movie = "CREATE TABLE movie ( movie_id int(11) NOT NULL auto_increment, movie_name varchar(255) NOT NULL, movie_type tinyint(2) NOT NULL default 0, movie_year int(4) NOT NULL default 0, movie_leadactor int(11) NOT NULL default 0, movie_director int(11) NOT NULL default 0, PRIMARY KEY (movie_id), KEY movie_type (movie_type,movie_year) )"; //utworz tabele movietype $movietype = "CREATE TABLE movietype ( movietype_id int(11) NOT NULL auto_increment, movietype_label varchar(100) NOT NULL, PRIMARY KEY (movietype_id) )"; //utworz tabele people $people = "CREATE TABLE people ( people_id int(11) NOT NULL auto_increment, people_fullname varchar(255) NOT NULL, people_isactor tinyint(1) NOT NULL default 0, people_isdirector tinyint(1) NOT NULL default 0, PRIMARY KEY (people_id) )"; ?>
a tu dane ktore dodalem
<?php //polaczenie z mysql // uaktywnij odpowiednia baze danych //wstaw dane do tabeli movie $insert = "INSERT INTO movie (movie_id, movie_name, movie_type, " . "movie_year, movie_leadactor, movie_director) " . "VALUES (1, 'Bruce Wrzechmogacy', 5, 2003, 1, 2), " . "(2, 'Zycie biurowe', 5, 1999, 5, 6), " . "(3, 'Wielki Kanion', 2, 1991, 4, 3)" ; //wstaw dane do tabeli movietype $type = "INSERT INTO movietype (movietype_id, movietype_label) " . "VALUES (1, 'Science-fiction'), " . "(2, 'Dramat'), " . "(3, 'Przygoda'), " . "(4, 'Wojenny'), " . "(5, 'Komedia'), " . "(6, 'Horror'), " . "(7, 'Akcja'), " . "(8, 'Dla dzieci')"; // wstaw dane do tabeli people $people = "INSERT INTO people (people_id, people_fullname, " . "people_isactor, people_isdirector) " . "VALUES (1, 'Jim Carrey', 1, 0), " . "(2, 'Tom Shadyac', 0, 1), " . "(3, 'Lawrence Kasdan', 0, 1), " . "(4, 'Kevin Kline', 1, 0), " . "(5, 'Ron Livingston', 1, 0), " . "(6, 'Mike Judge', 0, 1)"; ?>
Z góry dziękuję za udzieloną pomoc
