grlayouts
Members-
Posts
342 -
Joined
-
Last visited
Everything posted by grlayouts
-
what have a missed its not runing all the queries. $txsql = "UPDATE players set cashaccount=cashaccount+5, UPDATE players set rank=Donator where user='$_POST[item_name]', insert into log (owner,log) values(1,'<b>$_POST[item_name] Has just bought upgrade 1</b>')"; $resultat_txsql = mysql_query($txsql);
-
one missing i. lol thanks very much.
-
unfortunatly not. it now completes but nothing prints or updates in the database.
-
indentation. the script is about 20 lines long and i wouldnt say complex
-
ok a have a php case where there is a drop down you select the feature and type the amount and it should run. but only my first case is working the weights one. any idea's? <?php print "<form method=post action=intrain.php?view=train&step=trainingturns>Use<input name=amount>Energy Training On <select name=training><option value=weights>Weights</option><option value=agility>Tredmill</option></select>. <input type=submit value=Buy></form>"; if (isset($_POST)){ switch($_POST['training']) { case "weights": if ($stat[energy] < $amount) { print "<br>Your going to need $amount to train that hard."; } elseif ($stat[hp] < 1.0) { print "<br>You cant train unless you are alive you loser."; } else { $chance = rand(1,10); $chance13 = rand(1,2) / 700 / $stat[level] * $amount; $chance14 = rand(3,5) / 700 / $stat[level] * $amount; if ($chance == 1) { print "<center>Man you were so bad in the gym<bR> you got kicked out for slacking<br>next time actually do some weights."; mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } else { print " <center>Hey $stat[user] i never knew you were that fast!<br> you should come here more often if you want to stay in that condition<bR>You gained $chance14 strength<br>and $chance13 agility<br> <a href=intrain.php?action=tredmill>Run Again</a><bR><br> "; mysql_query("update players set strength=strength+$chance14 where id=$stat[id]"); mysql_query("update players set agility=agility+$chance13 where id=$stat[id]"); mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } } } } break; case "agilty": if ($stat[energy] < $amount) { print "<br>Your going to need $amount to train that hard."; } elseif ($stat[hp] < 1.0) { print "<br>You cant train unless you are alive you loser."; } else { $chance = rand(1,10); $chance13 = rand(1,2) / 700 / $stat[level] * $amount; $chance14 = rand(3,5) / 700 / $stat[level] * $amount; if ($chance == 1) { print "<center>Man you were so bad in the gym<bR> you got kicked out for slacking<br>next time actually do some weights."; mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } else { print " <center>Hey $stat[user] i never knew you were that fast!<br> you should come here more often if you want to stay in that condition<bR>You gained $chance14 strength<br>and $chance13 agility<br> <a href=intrain.php?action=tredmill>Run Again</a><bR><br> "; mysql_query("update players set strength=strength+$chance13 where id=$stat[id]"); mysql_query("update players set agility=agility+$chance14 where id=$stat[id]"); mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } } } } ?>
-
invalid? the first case works fine only the second fails.
-
post training is for the drop down then the two cases are inside, weights and agility.
-
did that as you said now completing but not doing the sql updates or prints.
-
214 which realates to line case "agilty":
-
when i run the following i get. Parse error: syntax error, unexpected T_CASE in intrain.php on line # <?php print "<form method=post action=intrain.php?view=train&step=trainingturns>Use<input name=amount>Energy Training On <select name=training><option value=weights>Weights</option><option value=agility>Tredmill</option></select>. <input type=submit value=Buy></form>"; if (isset($_POST)){ switch($_POST['training']) { case "weights": if ($stat[energy] < $amount) { print "<br>Your going to need $amount to train that hard."; } elseif ($stat[hp] < 1.0) { print "<br>You cant train unless you are alive you loser."; } else { $chance = rand(1,10); $chance13 = rand(1,2) / 700 / $stat[level] * $amount; $chance14 = rand(3,5) / 700 / $stat[level] * $amount; if ($chance == 1) { print "<center>Man you were so bad in the gym<bR> you got kicked out for slacking<br>next time actually do some weights."; mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } else { print " <center>Hey $stat[user] i never knew you were that fast!<br> you should come here more often if you want to stay in that condition<bR>You gained $chance14 strength<br>and $chance13 agility<br> <a href=intrain.php?action=tredmill>Run Again</a><bR><br> "; mysql_query("update players set strength=strength+$chance14 where id=$stat[id]"); mysql_query("update players set agility=agility+$chance13 where id=$stat[id]"); mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } } } } break; case "agilty": if ($stat[energy] < $amount) { print "<br>Your going to need $amount to train that hard."; } elseif ($stat[hp] < 1.0) { print "<br>You cant train unless you are alive you loser."; } else { $chance = rand(1,10); $chance13 = rand(1,2) / 700 / $stat[level] * $amount; $chance14 = rand(3,5) / 700 / $stat[level] * $amount; if ($chance == 1) { print "<center>Man you were so bad in the gym<bR> you got kicked out for slacking<br>next time actually do some weights."; mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } else { print " <center>Hey $stat[user] i never knew you were that fast!<br> you should come here more often if you want to stay in that condition<bR>You gained $chance14 strength<br>and $chance13 agility<br> <a href=intrain.php?action=tredmill>Run Again</a><bR><br> "; mysql_query("update players set strength=strength+$chance13 where id=$stat[id]"); mysql_query("update players set agility=agility+$chance14 where id=$stat[id]"); mysql_query("update players set energy=energy-$amount where id=$stat[id]"); } } } } ?>
-
if i have the following how do i make the new chat message a link? <? $numbernow=($chat[0])?> <? if ($stat[chatnow] < $numbernow) { print "NEW CHAT MESSAGES"; } ?>
-
it could be the , ie 10000 instead of 10,000 may be throughing it off. are you using a shopping cart or can you provide the rest of the code?
-
you have the wrong host name. if you have uploaded it to bravehost ftp try using localhost as the host.
-
sorry i had update user instead of ID.. thanks alot though.
-
the code i have uploads the file ok but it's not placing the images location into the database. the error i get is Could not update database". but i cant see the problem? move_uploaded_file($_FILES["file"]["tmp_name"], 'uploads/'. $_FILES["file"]["name"] .''); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; print '<p>'.$type.'</p>'; $fileName = $_FILES['file']['name']; mysql_query("insert into images (user, image) values('$stat[id]','$fileName')") or die("Could not update database."); } } }
-
why would i need to assign when i can use images/uploads/$Files[name].$files[extension] ??
-
none. it is the link i want to save in the database?? but the image uploads fine. just not the database part?
-
ne1?
-
i have an upload script that uploads the file fine. however it will not add the image to the database. i have placed the bit of code below, any ideas? { move_uploaded_file($_FILES["file"]["tmp_name"], 'uploads/'. $_FILES["file"]["name"] .''); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; print '<p>'.$type.'</p>'; mysql_query("insert into images (user, image) values('$stat[id]','. $_FILES["file"]["name"] .')") or die("Could not update database."); }
-
[SOLVED] Problem Reducing Product Quantity
grlayouts replied to stevesimo's topic in PHP Coding Help
cant you use if prod > quantity process.. else $quantity = $instock for example. -
i'm on pda so i cant write the code you need. http://www.terrawebdesign.com/multidimensional.php that should help you get a rough idea using arrays to create what you need.. if you cant get it msg me and i'll code it when im on a pc.
-
porta your script has no table html. ie rows and colums.
-
what do you have so far?