seany123 Posted May 25, 2009 Share Posted May 25, 2009 why is this doing that?? <?php if($_POST['dmoney']) { if($player->money > $_POST['dmoney']) { header('Location: ../your_gang/vault.php'); } else if($player->money <= $_POST['dmoney']) { $query = $db->execute("update `players` set `money`=? where `id`=?", array($player->money - $_POST['dmoney'], $player->id )); $query = $db->execute("update `gang` set `money`=? where `id`=?", array($gang->money + $_POST['dmoney'], $gang->id )); } } ?> Link to comment https://forums.phpfreaks.com/topic/159567-solved-unexpected-else_if/ Share on other sites More sharing options...
GingerRobot Posted May 25, 2009 Share Posted May 25, 2009 Because you have a few syntax errors: <?php if($_POST['dmoney']) { if($player->money > $_POST['dmoney']) //missing closing bracket { header('Location: ../your_gang/vault.php'); //missing semi-colon } elseif($player->money <= $_POST['dmoney']) { $query = $db->execute("update `players` set `money`=? where `id`=?", array($player->money - $_POST['dmoney'], $player->id )); $query = $db->execute("update `gang` set `money`=? where `id`=?", array($gang->money + $_POST['dmoney'], $gang->id )); } } ?> Link to comment https://forums.phpfreaks.com/topic/159567-solved-unexpected-else_if/#findComment-841673 Share on other sites More sharing options...
seany123 Posted May 25, 2009 Author Share Posted May 25, 2009 okay that error has been fixed... does anyone know why the queries arnt working??? <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> <?php if($_POST['dmoney']) { if($player->money > $_POST['dmoney']) //missing closing bracket { header('Location: ../your_gang/vault.php'); //missing semi-colon } elseif($player->money <= $_POST['dmoney']) { $query = $db->execute("update `players` set `money`=? where `id`=?", array($player->money - $_POST['dmoney'], $player->id )); $query = $db->execute("update `gang` set `money`=? where `id`=?", array($gang->money + $_POST['dmoney'], $gang->id )); } } ?> Link to comment https://forums.phpfreaks.com/topic/159567-solved-unexpected-else_if/#findComment-841675 Share on other sites More sharing options...
GingerRobot Posted May 25, 2009 Share Posted May 25, 2009 No idea. What does your execute method look like? Do you get any errors? What actually happens? Link to comment https://forums.phpfreaks.com/topic/159567-solved-unexpected-else_if/#findComment-841680 Share on other sites More sharing options...
seany123 Posted May 25, 2009 Author Share Posted May 25, 2009 ill open a new thread. Link to comment https://forums.phpfreaks.com/topic/159567-solved-unexpected-else_if/#findComment-841681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.