1

Struggling with a simple insert command, i'm getting the error

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 'All In: 
The Poker Movie, tells the story of poker focusing on why one of our nat' 
at line 2"

Basically passing film information into a table, here is the code -

$query1 = "INSERT INTO Films_Info (Films_ID,FilmName, FilmRelease, Synopsis,Poster,CritScore,AudScore,Director,Studio,IMDB,date_added_db) 
VALUES ('',$Film_Name', '$Film_Release','$filmsynopsis','$film_image','$film_critic','$film_audience','$film_director','$film_studio','$film_imdbID','')";
$runquery1 = mysql_query($query1)or die(mysql_error()); 

Thanks guys

2
  • 2
    $Film_Name' this bit is missing the opening quote I believe Commented Apr 17, 2012 at 23:26
  • You should also pass through mysql_real_escape_string() not par-sey for any sql injections you may have but to escape any quotes ect that will break your query. Commented Apr 17, 2012 at 23:35

2 Answers 2

7

It looks like that you are missing an ' before $Film_Name. Can you add the missing apostrophe?

Sign up to request clarification or add additional context in comments.

1 Comment

That fixed that error but its still giving a sql syntax error, saying its near a part of the entered data?
1

If you have phpmyadmin enabled on you server, you can paste the code into the SQL-Field to get syntax highlighting on the SQL query.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.