Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help please

Status
Not open for further replies.

yebaws

Technical User
Mar 22, 2007
42
GB
Can anybody see what the error is here please?

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 'WHERE id = 3' at line 1 UPDATE instructors SET course1 = 'Scottish Research Online', course2 = 'Scotland 1750 - 1850: Beyond the OPRs', course3 = 'England & Wales Online – Bring Your Knowledge to the Web', course4 = 'Ireland: A Practical Approach to Family History', course5 = 'Researching Irish Ancestors Before 1820', course6 = 'One to One Tutorial', course7 = '', course8 = '', mainimage = ' homepageimage = '', publication1link = '', publication2link = '', publication3link = '', publication4link = '', publication1image = '', publication2image = '', publication3image = '', publication4image = '', publicationsfooter = 'Buy Sherry\'s Books Now - simply click on the book to be taken to the Ancestry Store.', WHERE id = 3 Instructor Details Modified

and this is the code in the page I'm using to try and update the database:

if ($REQUEST_METHOD == "POST") {



$SQL = " UPDATE instructors SET ";
$SQL = $SQL . " course1 = '$course1', ";
$SQL = $SQL . " course2 = '$course2', ";
$SQL = $SQL . " course3 = '$course3', ";
$SQL = $SQL . " course4 = '$course4', ";
$SQL = $SQL . " course5 = '$course5', ";
$SQL = $SQL . " course6 = '$course6', ";
$SQL = $SQL . " course7 = '$course7', ";
$SQL = $SQL . " course8 = '$course8', ";
$SQL = $SQL . " mainimage = '$mainimage', ";
$SQL = $SQL . " homepageimage = '$homepageimage', ";
$SQL = $SQL . " publication1link = '$publication1link', ";
$SQL = $SQL . " publication2link = '$publication2link', ";
$SQL = $SQL . " publication3link = '$publication3link', ";
$SQL = $SQL . " publication4link = '$publication4link', ";
$SQL = $SQL . " publication1image = '$publication1image', ";
$SQL = $SQL . " publication2image = '$publication2image', ";
$SQL = $SQL . " publication3image = '$publication3image', ";
$SQL = $SQL . " publication4image = '$publication4image', ";
$SQL = $SQL . " publicationsfooter = '$publicationsfooter', ";
$SQL = $SQL . " WHERE id = $id";


$result = mysql_db_query($db,"$SQL",$cid);

if (!$result) {
echo("ERROR: " . mysql_error() . "\n$SQL\n"); }

echo ("Instructor Details Modified\n");

}

driving me nuts.....
 
This would be a MYSQL issue, anyway:

Your last comma right before the Where clause I assume should not be there, and throws off the query.

Code:
...book to be taken to the Ancestry Store.'[red]>[/red],[red]<[/red] WHERE id = 3

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
thank you thank you thank you. Always something really silly. Now I can go to bed
 
Glad I could help.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top