[PHP-DB] mysql adding

2004-06-04 Thread Steven Morgan
is there anyway to add 1 to an int with 1 mysql query, i know i can pull 
the value down with a SELECT then add 1 with php.. then do an UPDATE on 
it.. but i didn't know if there was any other way?
thanks
Steve Mo'

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] mysql adding

2004-06-04 Thread Micah Stevens

update field = field + 1;



On Friday 04 June 2004 01:47 pm, Steven Morgan wrote:
 is there anyway to add 1 to an int with 1 mysql query, i know i can pull
 the value down with a SELECT then add 1 with php.. then do an UPDATE on
 it.. but i didn't know if there was any other way?
 thanks
 Steve Mo'

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql adding

2004-06-04 Thread Micah Stevens

Wait, sorry, It's late.. 

update tablename set fieldname = fieldname + 1;

That will increment all the rows in table, you can add a 'where' statement to 
limit the update. 

update tablename set fieldname = fieldname + 1 where indexfield = someindex;

-Micah

On Friday 04 June 2004 01:47 pm, Steven Morgan wrote:
 is there anyway to add 1 to an int with 1 mysql query, i know i can pull
 the value down with a SELECT then add 1 with php.. then do an UPDATE on
 it.. but i didn't know if there was any other way?
 thanks
 Steve Mo'

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php