Excuse me for jumping in. "UPDATE table SET a=$a"
1. I assume the double quotes in your original message are meant to highlight the problem statement. 2. As written, you are attempting to set an integer type column to the string literal consisting of the characters $ and a. MySQL rejects this for either syntax error or type mismatch, whichever comes first in its parsing. 3. When you place the quotes around $a, PHP replaces it in the SELECT statement with the value that the variable $a represents before sending it to MySQL. You'll need to refer to the PHP manual for more detail. I trust you had a restful nap. Doug On Mon, 4 Mar 2002 11:19:05 +0100, Andreas Dau wrote: >Thx for ur quick help.... I will check after a short nap *ggg* > >> -----Ursprngliche Nachricht----- >> Von: DL Neil [mailto:[EMAIL PROTECTED]] >> Gesendet: Montag, 4. Mrz 2002 11:03 >> An: Andreas Dau >> Betreff: Re: syntax Q >> >> Hello Andreas, >> >> > > I just encountered the following: let $a be a numeric php >> expression, >> > a >> > > the corresponding integer field in a table. When I say: "UPDATE >> table >> > > SET a=$a" it denies the update. When I say: "Update table SET >> a='$a'" >> > it >> > > performs the update. Uhm, now I am wondering. Isn't 'something' >> > supposed >> > > to be a string? >> > >> > >> > Agreed. >> > What does the SQL CREATE statement look like? >> > What does PHP's assignment of value to $a (and relevant statements >> > leading up to it) look like? >> > Are you sure (the PC thinks) they are both integers? >> >> >> Created with phpmyadmin, column type integer(10). Value to be >inserted >> comes from a method=post script at no point treated other as a >> numeric... >> >> =uh-oh, my theory is looking shaky!? >> However such conclusion (numeric) may not be the case. Try running the >> 'form' and inserting a specific integer value, eg 7. >> Put a debug routine like this into the PHP after the POST is processed >> and before the MySQL call: >> >> echo "Value of a appears to be $a~"; >> if ( $a == 7 ) { echo " PHP says it is seven"; } >> else { echo " PHP says it is not seven"; } >> if ( $a === 7 ) { echo " PHP says it is integer seven "; } >> else { echo " PHP says it is not integer seven "; } >> echo "<BR>"; >> >> (code not syntax checked) >> >> Please advise, >> =dn > > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail <[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php