Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- UPDATE refuses to update in php, but does in phpadmin


rocknbil - 5:21 pm on Apr 21, 2011 (gmt 0)


Agreed . . it almost seems like php is passing the value as a string, and mysql is accepting it that way somehow. That would always give an 0. Maybe

$j = "UPDATE `catcount` SET `itemcnt` = " . (int)$count[0] . " WHERE `name` = '" . $row['vendorid'] . "';

or

$j = "UPDATE `catcount` SET `itemcnt` = " . intval($count[0]) . " WHERE `name` = '" . $row['vendorid'] . "';

It your server configured to display errors? If not, check your error log . . . or turn error reporting on, there may be an unseen PHP error ocurring.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4300520.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com