Re: mysql update not working
| From: | Chris Sherwood | Date: | Wed, 25 Jun 2003 21:20:26 +0000 |
| Subject: | Re: mysql update not working | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152878@lists.php.net to get a copy of this message | ||
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" <steve@goquest.com>
To: <php-general@lists.php.net>
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
>
>