Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP/MySQL where have I gone wrong?
    primarykey
    data
    text
    <p>So first of all I'm trying to populate a database with this PHP script. The error I am receiving is - "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" I understand what the error is I just cannot seem to find it.</p> <pre><code>&lt;?php include("server_connect.php"); //select the db mysql_select_db("moviedatabase"); //populate titles $insert = "INSERT INTO tblMovieTitle (movie_id, movie_title, movie_genre, movie_rating, movie_actor_fname, movie_actor_lname) " . "VALUES (1, 'Inglorious Basterds', 'War', 8, 'Brad', 'Pitt'), " . "(2, 'Zombieland', 'Comedy', 8, 'Jesse', 'Eisenberg'), " . "(3, 'Cowboys and Aliens', 'Action', 6, 'Olivia', 'Wilde'), " . "(4, 'Contagion', 'Drama', 7, 'Matt', 'Damon')"; $results = mysql_query($insert) or die (mysql_error()); //populate genre $genre = "INSERT INTO tblMovieGenre (movie_genre_ID, movie_genre) " . "VALUES (100, 'Action'), " . "(101, 'Horror'), " . "(102, 'Comedy'), " . "(103, 'War'), " . "(104, 'Drama'), " . "(105, 'Kids'), " . "(106, 'Sci-Fi'), " . "(107, 'Action'), " ; $results = mysql_query($genre) or die (mysql_error()); //populate movie rating $rating = "INSERT INTO tblMovieRating (movie_rating_ID, movie_rating ) " . "VALUES (1001, 1), " . "(1002, 2), " . "(1003, 3), " . "(1004, 4), " . "(1005, 5), " . "(1006, 6), " . "(1007, 7), " . "(1008, 8), " . "(1009, 9), " . "(1010, 10)"; $results = mysql_query($rating) or die (mysql_error()); //check if database is populated echo "Database populated"; ?&gt; </code></pre> <p>Yeah so I really can't figure out where the error is coming from, anyone? Thanks beforehand for the help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload