seany123 Posted May 25, 2009 Share Posted May 25, 2009 okay so i have this code... <?php if($_POST['dmoney']) { if($player->money <= $_POST['money']) { header('Location: ../your_gang/vault.php'); echo"FAIL"; } else if($player->money > $_POST['money']) { $query = $db->execute("update `players` set `money`=? where `id`=?", array($player->money - $_POST['money'], $player->id )); $query = $db->execute("update `gang` set `money`=? where `id`=?", array($gang->money + $_POST['money'], $player->gang_id )); echo $_POST['money']; } } ?> <tr> <td colspan='2' align='center'><input type='text' name='money' size='15' maxlength='20' value='<?=$player->money?>'> <input type='submit' name='dmoney' value='Donate Money'></td> <td colspan='2' align='center'><input type='text' name='points' size='15' maxlength='20' value='<?=$player->points?>'> <input type='submit' name='dpoints' value='Donate Points'></td> </tr> the first query Works... however the second query doesnt work.. (gang) i think the reason is because i havnt called gang properly or something along that line... i do have this in an include at the top of my page which i thought would do the job... <?php //Populates $gang variable $query = $db->execute("select * from gangs where `id`= $player->gang_id"); if ($query->recordcount() == 0) { header("Location: ../your_gang/register.php"); } else { $gang = $query->fetchrow(); } ?> and in actual fact when i try and echo something from $gang it does echo the correct value. Link to comment https://forums.phpfreaks.com/topic/159570-query-not-running/ Share on other sites More sharing options...
Masna Posted May 25, 2009 Share Posted May 25, 2009 <?php //Populates $gang variable $query = $db->execute("select * from gangs where `id`= '".$player->gang_id."'"); if ($query->recordcount() == 0) { header("Location: ../your_gang/register.php"); } else { $gang = $query->fetchrow(); } ?> Link to comment https://forums.phpfreaks.com/topic/159570-query-not-running/#findComment-841700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.