What error are you getting, exactly?

MySQL is not case-sensitive with regards to commands, but it is 
case-sensitive for table names, column names, etc.  Make sure that the 
table names are exactly exact ;-) including cases, etc.

You might double-check the values in the variables: do they contain special 
characters (like ' or ") that need to be escaped out with 
addslashes()?  Check the datatypes for the columns as well.  If the 
datatype is a number, the single quote is not needed (and will, in fact, 
cause an error).

I've had trouble in the past using variables with single quotes in the 
string and variable interpolation.  In this sort of case I usually use:

         $query = "stuff='".$stuff."'";

instead of

         $query = "stuff = '$stuff'";

It's clunkier, but it might work.  Give it a try as well.

Ultimately, though, I suspect that it's your data that's causing the problems.


At 07:36 PM 12/4/2001, Tyler Longren wrote:
>Everything looks good to me...try this:
>$result = mysql_query("UPDATE table SET value1='$value1',value2='$value2'
>WHERE id='$id'");
>
>Although I doubt MySQL cares if certain words are capitalized.
>
>Good luck though,
>Tyler Longren
>
>----- Original Message -----
>From: "Greg Sidelinger" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, December 04, 2001 9:27 PM
>Subject: [PHP] mysql update query
>
>
> > I'm having trouble getting an update query to work
> >
> > Here is what I'm doing
> >
> > $result = mysql_query("update table set value1='$value1',
> > value2='$value2' where id='$id'");
> >
> > It is not updating the database.  All the $vars have values and I'm
> > using the correct columns names.  Could someone please point me in the
> > correct direction because I have been trying different things for a
> > while but can't seem to get it to work.
> >
> > Greg
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to