MySQL value minus 1?
Posted: Fri Sep 21, 2012 11:04 am
Hi there,
I've been having (more) troubles with SQL :/
I need to get an SQL value (the column is an int) and then minus one from that.
The only problem is, it won't do anything :/ (no errors)
[syntax=php]$q = mysql_query("SELECT * FROM stats WHERE `user` = '{$session_NAME}'");
$q = mysql_fetch_array($q);
$total_stats = $q['total_stats']-1;
mysql_query("UPDATE stats SET `total_stats` = '{$total_stats}' WHERE `user` = '{$session_NAME}'");[/syntax]
I really can't see whats wrong here :<
(And yes, this is for a statistics script. I would like to be able to delete entries)
If anyone could help, that would be amazing![Smile :)](./images/smilies/icon_e_smile.gif)
I've been having (more) troubles with SQL :/
I need to get an SQL value (the column is an int) and then minus one from that.
The only problem is, it won't do anything :/ (no errors)
[syntax=php]$q = mysql_query("SELECT * FROM stats WHERE `user` = '{$session_NAME}'");
$q = mysql_fetch_array($q);
$total_stats = $q['total_stats']-1;
mysql_query("UPDATE stats SET `total_stats` = '{$total_stats}' WHERE `user` = '{$session_NAME}'");[/syntax]
I really can't see whats wrong here :<
(And yes, this is for a statistics script. I would like to be able to delete entries)
If anyone could help, that would be amazing
![Smile :)](./images/smilies/icon_e_smile.gif)