hmmm can you check to see if your field is exactly named desc in the table... also whether or not it can accept string ie char or varchar. ----- Original Message ----- From: "Steven Efurd" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 25, 2003 2:03 PM Subject: [PHP] mysql update not working
> I have the following code: > > > $sql = "UPDATE class_sub SET desc = '$catdesc', sub_cat = '$subcatname' > WHERE id='$catid'"; > echo $sql; > $sql_result = mysql_query($sql); > if (!$sql_result) > { > echo "<P>Couldn't update record!<br></p>"; > echo mysql_error(); > exit; > } else > { > header("Location: index.php"); /* Redirect browser */ > exit; > } > here is the actual sql statement: > UPDATE class_sub SET desc = 'Come play with us! This class is designed > to challenge your cardiovascular and muscular endurance. Participants > will work or \"play\" in different activities such as team exercises, > sprints, obstacle courses, cycling, plyometrics, and core conditioning. > Challenge yourself like never before!', sub_cat = 'Recess' WHERE id='4' > > And the error: > > > Couldn't update record! > > You have an error in your SQL syntax near 'desc = 'Come play with us! > This class is designed to challenge your cardiovascul' at line 1 > > > > the table is setup ok, i can INSERT data just fine. > If i remove "desc = whatever" from the sql statement it works fine. It > will update all fields in the table except "desc". Now for the life of > me I cannot see a problem here. Could someone please give a pointer in > the right direction. > > Thanks > Steve > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php