View Full Version : Mysql update gold=gold-2 problem
01-31-2012, 06:11 PM
Hi, if gold is 2 than gold=2-2 and my update doesnt work .
where is the answer ??:eek::confused::thumbsup: what should i do?:rolleyes::p
01-31-2012, 06:19 PM
Show us your code?
01-31-2012, 06:27 PM
if there is 2-1 it works, so :]
01-31-2012, 07:31 PM
Literal 2 - 1 would = 1. And literal 2 - 2 = 0.
Post the SQL code you are using.
01-31-2012, 07:38 PM
mysql_query("UPDATE gyvenvietes SET gold=gold-$gold WHERE gyvenvietes_pavadinimas='$stulpeliai[gyvenviete]'");
01-31-2012, 07:47 PM
wow... now it works, maybe my xampp got something with that??
01-31-2012, 08:01 PM
I can't see the web server changing a single thing. Assuming that PHP has always been parsed, if in one scenario it worked and another it did not, this indicates that likely the WHERE clause is incorrect, the query has failed, or a branch prevents it from ever attempting.
Web servers won't just intermittently choose to execute something.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.