Jump to content

still not updating.


grlayouts

Recommended Posts

 

 

when i hit sell 400 drugs it does nothing updates nothing and doesnt print anything.

 

<?php
print "<form method=post action=cmarket.php?view=sell&step=sell>Sell <input name=amount><select name=seller><option value=drugs>Drugs</option></select>. <input type=submit value=Sell></form>";
if ($step == "sell") 
{
switch($seller)
{
	case "drugs":
		if ($stat['drugs'] < $amount) {
			print "Sorry mate, you don't have the drugs.";
		} else {
			mysql_query("update players set drugs=(drugs-$amount) where id=".$stat[id]);
			mysql_query("update players set credits=($amount*".$stat['drugprice'].") where id=".$stat['id']);
			print "You sold $amount of drugs."; 
		}
	break;
	case "SteakHouse":
		if ($stat[credits] < 60000) {
			print "Sorry mate, you don't have the cash.";
		} else {
			mysql_query("update players set steakhouse=steakhouse+1 where id=$stat[id]");
			mysql_query("update players set credits=credits-60000 where id=$stat[id]");
			mysql_query("update players set employees=employees+10 where id=$stat[id]");
			print "Steak Building added."; 
		}
	break;
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/46236-still-not-updating/
Share on other sites

try:

 

$sql1 = ""UPDATE players SELECT drugs, id FROM players where id = '".$stat['id']."' SET drugs = (drugs - '".$amount"') WHERE id = '".$stat['id']."'";

mysql_query($sql1);

 

 

 

thats just the first query, try it and then adapt to the second query....... but can someone back me up on the embeded SELECT, i know it works in  INSTER INTO queryies, but not sure about the UPDATE querys

 

 

goodluck

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/46236-still-not-updating/#findComment-224810
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.