Good evening everybody.

I'm trying to add values to a database. The script is connecting to the server just fine. It is finding the correct db just fine. The issue is when I try to add stuff to the db...

Heres the code:


include 'dbconnect.php';

$edname = 'bob';
$edemail = '1234';
$writername = 'jess';
$draft = 'p1';
$interviews = 'bobby jones';
$title = 'bobby jones goes to town';
$decription = 'he really goes to town';
$section = 'news';
$edphone = '1234567';

mysql_query("INSERT INTO callsheet VALUES ('$edname', '$edemail', '$writername', '$draft', '$interviews', '$title', '$decription', '$section', '$edphone');")


The error is this:
Parse error: parse error, unexpected T_STRING in /homepages/6/d161045083/htdocs/callsheet/dbaddcallsheet.php on line 17

I have no idea whats going on. Other INSERT INTO querys that I run work just fine. As far as I can tell I'm using the same syntax... help?

12 Years
Discussion Span
Last Post by mrcb

Try putting a semi-colon after the query. If that doesn't work. take the semicolon out of the quotes of the query, its not needed in this. THe semi-colon is used in SQL to denote the end of the query, its not really needed when using php. It'll automatically end it as the query. So take out that semicolon and put it at the end of the entire command. That's part of the problem if that doesn't work move the query into a variable and do it that way. That should work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.