Bullet Posted August 22, 2008 Share Posted August 22, 2008 The main code (PHP script): if ($_POST['weapon']){ $equipment_weapon = strip_tags($_POST['equipment_weapon']); $info = mysql_fetch_object(mysql_query("SELECT * FROM `inventory` WHERE `id` = '".$equipment_weapon."'")); if (!$equipment_weapon){ echo "<br><center><f>You must choose which weapon to use!</f></center>"; }elseif ($equipment_weapon){ $check_for_oc = mysql_num_rows(mysql_query("SELECT * FROM `oc` WHERE `leader` = '".$fetch->username."'")); if (($fetch->oc == "0") && ($check_for_oc == "0")){ echo "<br><center><f>You are not in an Organised Crime to buy equipment for!</f></center>"; }elseif (($fetch->oc != "0") && ($check_for_oc != "0")){ mysql_query("UPDATE `oc` SET `weaponsequip` = '".$info->name."', `weaponsstatus` = 'Ready' WHERE `leader` = '".$fetch->currentoc."'"); mysql_query("DELETE FROM `inventory` WHERE `id` = '".$equipment_weapon."'"); echo "<br><center><s>The $info->name is now being used as the weapon for the Organized Crime!</s></center>"; HTML: </tr><tr> <?php $garage_query = mysql_query("SELECT * FROM `inventory` WHERE `username` = '".$username."' AND `type` = 'Weapon' ORDER BY `id`"); $garage_num = mysql_num_rows($garage_query); if ($garage_num == "0"){ echo "<td bgcolor=\"#2c2c2c\" colspan=\"3\" align=\"center\">You have no weapons.</td></tr>"; } while($garage_fetch = mysql_fetch_object($garage_query)){ echo "<td bgcolor=\"#2c2c2c\"><input name=\"equipment_weapon\" type=\"radio\" value=\"$garage_fetch->id\"></td> <td bgcolor=\"#2c2c2c\">$garage_fetch->name</td> </tr>"; } ?> <tr align="left" bgcolor="#2c2c2c"> <td colspan="5" align="center"><input name="weapon" type="submit" id="weapon" value="Use!" title="Use this house!" class="button"></td> Anyone know why I can't select the weapon? It just refreshes, help? Link to comment https://forums.phpfreaks.com/topic/120794-solved-wont-let-me-choose/ Share on other sites More sharing options...
JasonLewis Posted August 22, 2008 Share Posted August 22, 2008 Where is your form tag? Is that set up correctly? Just echo variables out here and there to test where your code is getting to. Simple debugging, helps a lot. Link to comment https://forums.phpfreaks.com/topic/120794-solved-wont-let-me-choose/#findComment-622667 Share on other sites More sharing options...
Bullet Posted August 22, 2008 Author Share Posted August 22, 2008 Ok I'll check it out. Link to comment https://forums.phpfreaks.com/topic/120794-solved-wont-let-me-choose/#findComment-622881 Share on other sites More sharing options...
Bullet Posted August 22, 2008 Author Share Posted August 22, 2008 I've looked but not found anything. Link to comment https://forums.phpfreaks.com/topic/120794-solved-wont-let-me-choose/#findComment-622889 Share on other sites More sharing options...
Bullet Posted August 22, 2008 Author Share Posted August 22, 2008 Fixed, there was a error in the MySQL. Link to comment https://forums.phpfreaks.com/topic/120794-solved-wont-let-me-choose/#findComment-622896 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.