smithmr8 Posted February 18, 2008 Share Posted February 18, 2008 The below script is showing as a blank page for me, which due to the fact that error messages were turned off by my host, means there is something wrong with it. I've gone over it multiple times trying to find it, but to no avail. <?php include('header.php') ?> <?php if($_GET['step'] == 'darts'){ echo "<b>El Darto Biro</b><br>"; echo "<i>Try improving your aim by throwing some darts!</i><br><br>"; echo "<a href=thecountryclub.php?step=darts&action=throw>Throw Dart</a> (-2% Energy)<br>"; } elseif ($_GET['step'] == 'darts' & $_GET['action'] == 'throw'){ if($x['energy'] >= 2) { mysql_query("UPDATE users SET energy=energy-2 WHERE ID=$x[iD]") or die mysql_error(); $chance = rand(0,$x['level']); if($chance >= 1){ $expgain = $chance; echo "You successfully threw a dart and gained".$expgain."EXP"; mysql_query("UPDATE users SET exp=exp+$expgain, total_exp=total_exp+$expgain WHERE ID=$x[iD]")or die mysql_error(); if($x['exp'] > ($x['level']*$x['exp_needed']){ $expnumber = ($x['exp_needed']*$x['level']); mysql_query("UPDATE users SET exp=exp-$expnumber, level=level+1 WHERE ID=$x[iD]")or die mysql_error(); echo "You have gained a level!"; } } else { echo "You failed to throw the dart straight and hit someone in the head<br>"; } } else { echo "You dont have enough energy to do this.<br>"; } } else { echo "<b>The Country Club</b><br><br>"; echo "<a href=thecountryclub.php?step=darts>El Darto Biro</a><br>"; } ?> <?php include('footer.php') ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2008 Share Posted February 18, 2008 You need to put parenthesis around the argument to the "or die" clauses. Ken Quote Link to comment Share on other sites More sharing options...
smithmr8 Posted February 18, 2008 Author Share Posted February 18, 2008 I ended up just removing those parts completely. But, its still not working. :/ <?php include('header.php') ?> <?php if($_GET['step'] == 'darts'){ echo "<b>El Darto Biro</b><br>"; echo "<i>Try improving your aim by throwing some darts!</i><br><br>"; echo "<a href=thecountryclub.php?step=darts&action=throw>Throw Dart</a> (-2% Energy)<br>"; } elseif ($_GET['step'] == 'darts' & $_GET['action'] == 'throw'){ if($x['energy'] >= 2) { mysql_query("UPDATE users SET energy=energy-2 WHERE ID=$x[iD]"); $chance = rand(0,$x['level']); if($chance >= 1){ $expgain = $chance; echo "You successfully threw a dart and gained".$expgain."EXP"; mysql_query("UPDATE users SET exp=exp+$expgain, total_exp=total_exp+$expgain WHERE ID=$x[iD]"); if($x['exp'] > ($x['level']*$x['exp_needed']){ $expnumber = ($x['exp_needed']*$x['level']); mysql_query("UPDATE users SET exp=exp-$expnumber, level=level+1 WHERE ID=$x[iD]"); echo "You have gained a level!"; } } else { echo "You failed to throw the dart straight and hit someone in the head<br>"; } } else { echo "You dont have enough energy to do this.<br>"; } } else { echo "<b>The Country Club</b><br><br>"; echo "<a href=thecountryclub.php?step=darts>El Darto Biro</a><br>"; } ?> <?php include('footer.php') ?> Dammit! Quote Link to comment Share on other sites More sharing options...
elpaisa Posted February 18, 2008 Share Posted February 18, 2008 Try removing some parts of code until it reports the error <?php include('header.php') ?> <?php error_reporting(E_ALL); if($_GET['step'] == 'darts') { echo "<b>El Darto Biro</b><br>"; echo "<i>Try improving your aim by throwing some darts!</i><br><br>"; echo "<a href=thecountryclub.php?step=darts&action=throw>Throw Dart</a> (-2% Energy)<br>"; } elseif($_GET['step'] == 'darts' & $_GET['action'] == 'throw') { if($x['energy'] >= 2) { mysql_query("UPDATE users SET energy=energy-2 WHERE ID=$x[iD]") or die mysql_error(); $chance = rand(0,$x['level']); if($chance >= 1) { $expgain = $chance; echo "You successfully threw a dart and gained".$expgain."EXP"; mysql_query("UPDATE users SET exp=exp+$expgain, total_exp=total_exp+$expgain WHERE ID=$x[iD]")or die mysql_error(); if($x['exp'] > ($x['level']*$x['exp_needed']) { $expnumber = ($x['exp_needed']*$x['level']); mysql_query("UPDATE users SET exp=exp-$expnumber, level=level+1 WHERE ID=$x[iD]")or die mysql_error(); echo "You have gained a level!"; } } else { echo "You failed to throw the dart straight and hit someone in the head<br>"; } } else { echo "You dont have enough energy to do this.<br>"; } } else { echo "<b>The Country Club</b><br><br>"; echo "<a href=thecountryclub.php?step=darts>El Darto Biro</a><br>"; } ?> <?php include('footer.php') ?> Quote Link to comment Share on other sites More sharing options...
smithmr8 Posted February 18, 2008 Author Share Posted February 18, 2008 I removed this part, and it does show the page with some error's listed. if($x['energy'] >= 2) { mysql_query("UPDATE users SET energy=energy-2 WHERE ID=$x[iD]") or die mysql_error(); $chance = rand(0,$x['level']); if($chance >= 1) { $expgain = $chance; echo "You successfully threw a dart and gained".$expgain."EXP"; mysql_query("UPDATE users SET exp=exp+$expgain, total_exp=total_exp+$expgain WHERE ID=$x[iD]")or die mysql_error(); if($x['exp'] > ($x['level']*$x['exp_needed']) { $expnumber = ($x['exp_needed']*$x['level']); mysql_query("UPDATE users SET exp=exp-$expnumber, level=level+1 WHERE ID=$x[iD]")or die mysql_error(); echo "You have gained a level!"; } } else { echo "You failed to throw the dart straight and hit someone in the head<br>"; } } else { echo "You dont have enough energy to do this.<br>"; } The part causing it not to show the page at all is in this part. The error's were... Notice: Undefined index: step in /home/template/public_html/beta/thecountryclub.php on line 6 Notice: Undefined index: step in /home/template/public_html/beta/thecountryclub.php on line 12 Notice: Undefined index: action in /home/template/public_html/beta/thecountryclub.php on line 12 Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 <?php include('header.php') ?> <?php if($_GET['step'] == 'darts'){ echo "<b>El Darto Biro</b><br>"; echo "<i>Try improving your aim by throwing some darts!</i><br><br>"; echo "<a href=thecountryclub.php?step=darts&action=throw>Throw Dart</a> (-2% Energy)<br>"; } elseif ($_GET['step'] == 'darts' & $_GET['action'] == 'throw'){ if($x['energy'] >= 2) { mysql_query("UPDATE users SET energy=energy-2 WHERE ID=$x[iD]") or die (mysql_error()); $chance = rand(0,$x['level']); if($chance >= 1){ $expgain = $chance; echo "You successfully threw a dart and gained".$expgain."EXP"; mysql_query("UPDATE users SET exp=exp+$expgain, total_exp=total_exp+$expgain WHERE ID=$x[iD]")or die (mysql_error()); if($x['exp'] > ($x['level']*$x['exp_needed'])){ $expnumber = ($x['exp_needed']*$x['level']); mysql_query("UPDATE users SET exp=exp-$expnumber, level=level+1 WHERE ID=$x[iD]")or die (mysql_error()); echo "You have gained a level!"; } } else { echo "You failed to throw the dart straight and hit someone in the head<br>"; } } else { echo "You dont have enough energy to do this.<br>"; } } else { echo "<b>The Country Club</b><br><br>"; echo "<a href=thecountryclub.php?step=darts>El Darto Biro</a><br>"; } ?> <?php include('footer.php') ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.