Jump to content

[SOLVED] unexpected else_if


seany123

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.