Try:

UPDATE users SET board_posts=(board_posts+1) WHERE username='tyler' AND
password='myfakepassword';


I am using <? mysql_query ("update $table set hits=(hits+1) where
id=$id"); ?> and it works fine.

-- Stewart

--- Tyler Longren <[EMAIL PROTECTED]> wrote:
> Well, here's the query that PHP is generating:
> UPDATE users SET board_posts=board_posts+1 WHERE username='tyler' AND
> password='myfakepassword'
> 
> If I copy and paste that exactly into the mysql client, it's executed
> correctly.  If I use phpMyAdmin to execute it, it IS NOT executed
> correctly
> (same as in my PHP code).  I really don't think this is a problem
> with my
> coding since it worked with previous versions of mysql.  Could PHP
> just be
> screwing up while sending the query to MySQL?
> 
> Also, if I use MySQL Front (www.mysqlfront.de), the query doesn't get
> executed properly.  It only works correctly when issuing the query
> from the
> mysql command line client.  :)
> 
> Tyler
> 
> ----- Original Message -----
> From: "DL Neil" <[EMAIL PROTECTED]>
> To: "Tyler Longren" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 26, 2002 8:52 AM
> Subject: Re: "SET field=field+1" no longer works?
> 
> 
> > Hi Tyler,
> > [back on-list so that others can offer their wisdom!]
> >
> > OK, so it's not a problem with the MySQL client, then it's likely
> the PHP.
> Most likely that the username and
> > password data values are strings and need to be properly contained
> with
> single- or double-quotation marks.
> >
> > If you need further assistance, first try some debug ECHOs on the
> three
> fields used in the query, and ECHO the
> > query itself immediately prior to the call to MySQL. (is the last
> how you
> posted (copy-pasted) the query into
> > the MySQL client, or did you type it into MySQL by hand?)
> >
> > If lights still don't go off, please post the PHP code snippet.
> >
> > Regards,
> > =dn
> >
> >
> > > I tried it in PHP first, and it doesn't work in that.  But, when
> I use
> the
> > > mysql client, it works as expected.  Any ideas?
> >
> >
> > > > Hello Tyler,
> > > >
> > > > Did someone pick up this question - haven't spotted a response
> on the
> > > list?
> > > > I haven't spotted any such mis-behavior under either Win2000 or
> WinNT.
> > > >
> > > > Are you entering the query at the command line or into some
> tool?
> > > > Have you tried another client?
> > > >
> > > > If it is still unresolved, send me (NOT the whole list) the
> actual
> query,
> > > and a short table with sample data,
> > > > and I'll try it on my two Win boxes here.
> > > >
> > > > Regards,
> > > > =dn
> > > >
> > > >
> > > > > I'm running MySQL on a Windows 2000 box.  I was running
> 3.23.47
> until
> > > > > 3.23.49 was released.  After upgrading to 3.23.49, queries
> like this
> > > don't
> > > > > work:
> > > > > UPDATE test_table SET board_posts=board_posts+1 WHERE
> username='blah'
> > > AND
> > > > > password='blah';
> > > > >
> > > > > Normally, that would increment the value in board_posts by 1,
> this
> no
> > > longer
> > > > > happens.  Is there a different way I should do this now?
> > > > >
> > > > > Thanks,
> > > > > Tyler
> > > > >
> > > > >
> > > >
> >
> ---------------------------------------------------------------------
> > > > > 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
> > > >
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > 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
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

---------------------------------------------------------------------
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

Reply via email to