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:

<?php

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?

Recommended Answers

All 2 Replies

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.

Thanks a bunch, that fixed it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.