Re: update using 'set' keyword

2006-03-14 Thread Prasanna Raj
Hi

Iam not sure about the answer correct me if iam wrong :(

Dont use single quotes in count_of_logons ..

Try : $sql = UPDATE members 
  SET count_of_logons = count_of_logons + 1
  WHERE logon_id  = '$logonid' 
  AND logon_pw= '$logonpw'
  AND email_verified = 'Y';

--Praj

On Mon, 13 Mar 2006 17:18:58 -0500
fbsd_user [EMAIL PROTECTED] wrote:

 Trying to bump the count_of_logons by 1 using this update.
 Phpmyadmin shows the count staying at zero.
 I think that this   SET count_of_logons = 'count_of_logons + 1' 
 is not coded correctly, but I get no errors so can not tell.
 
 Anybody have any ideas?
 
 The table def has   count_of_logons INT,
 
 $sql = UPDATE members 
  SET count_of_logons = 'count_of_logons + 1'
  WHERE logon_id  = '$logonid' 
  AND logon_pw= '$logonpw'
  AND email_verified = 'Y';
 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



update using 'set' keyword

2006-03-13 Thread fbsd_user
Trying to bump the count_of_logons by 1 using this update.
Phpmyadmin shows the count staying at zero.
I think that this   SET count_of_logons = 'count_of_logons + 1' 
is not coded correctly, but I get no errors so can not tell.

Anybody have any ideas?

The table def has   count_of_logons INT,

$sql = UPDATE members 
   SET count_of_logons = 'count_of_logons + 1'
 WHERE logon_id  = '$logonid' 
 AND logon_pw= '$logonpw'
 AND email_verified = 'Y';

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: update using 'set' keyword

2006-03-13 Thread Michael Stassen

fbsd_user wrote:

Trying to bump the count_of_logons by 1 using this update.
Phpmyadmin shows the count staying at zero.
I think that this   SET count_of_logons = 'count_of_logons + 1' 
is not coded correctly, but I get no errors so can not tell.


Anybody have any ideas?

The table def has   count_of_logons INT,

$sql = UPDATE members 
	   SET count_of_logons = 'count_of_logons + 1'
 WHERE logon_id  = '$logonid' 
 AND logon_pw= '$logonpw'

 AND email_verified = 'Y';



Why are you quoting 'count_of_logons + 1'?  In any case, that's the problem. 
'count_of_logons + 1' is a string.  You are assigning it to an INT, so it must 
be converted to a number.  Strings which do not start with anything numeric 
convert to 0.  For example:


mysql SELECT 'count_of_logons + 1' + 0;
+---+
| 'count_of_logons + 1' + 0 |
+---+
| 0 |
+---+
1 row in set (0.00 sec)

Leave out the quotes to get the expected result:

  $sql = UPDATE members
   SET count_of_logons = count_of_logons + 1
   WHERE logon_id  = '$logonid'
 AND logon_pw= '$logonpw'
 AND email_verified = 'Y';

Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]