noddy Posted April 11, 2009 Posted April 11, 2009 i am trying to make it so users can refill there searches, i am using this but it isnt working. if($_GET['spend'] == 'searches') { if($ir['crystals'] < 15); { print "You don't have enough Points!"; } else { print "You have paid 15 Points to refill searches."; $db->query("UPDATE users SET turns=50 WHERE userid=$userid"); $db->query("UPDATE users SET crystals=crystals-15 WHERE userid=$userid"); } } any help? Quote
AlabamaHit Posted April 11, 2009 Posted April 11, 2009 Re: yet another problem if($_GET['spend'] == 'searches') { if($ir['crystals'] < 15); { echo "You don't have enough Points!"; } else { echo "You have paid 15 Points to refill searches."; $do = sprintf("UPDATE users SET turns = 50, crystals = crystals - 15 WHERE userid = %u",($userid)); $db->query($do); } } Quote
noddy Posted April 11, 2009 Author Posted April 11, 2009 Re: yet another problem thanks for the fast reply, but it didn't work, could the problem be elsewhere? here is the whole file. <?php include "globals.php"; if(!$_GET['spend']) { print "Welcome to the Points temple! You have [b]{$ir['crystals']}[/b] Points. What would you like to spend your Points on? [url='usepoints.php?spend=refill']Energy Refill - {$set['ct_refillprice']} Points[/url] [url='usepoints.php?spend=IQ']IQ - {$set['ct_iqpercrys']} IQ per Point[/url] [url='usepoints.php?spend=money']Money - ¥".number_format($set['ct_moneypercrys'])." per Point[/url] [url='usepoints.php?spend=searches']Refill Searches -15 points[/url] "; } else { if($_GET['spend'] == 'refill') { if($ir['crystals'] <$set['ct_refillprice']) { print "You don't have enough Points!"; } else if($ir['energy'] == $ir['maxenergy']) { print "You already have full energy."; } else { $db->query("UPDATE users SET energy=maxenergy,crystals=crystals-{$set['ct_refillprice']} WHERE userid=$userid"); print "You have paid {$set['ct_refillprice']} Points to refill your energy bar."; } } else if($_GET['spend'] == 'IQ') { print "Type in the amount of Points you want to swap for IQ. You have [b]{$ir['crystals']}[/b] Points. One Point = {$set['ct_iqpercrys']} IQ.<form action='usepoints.php?spend=IQ2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'IQ2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough Points or did not fill out the form. [url='usepoints.php?spend=IQ']Back[/url]"; } else { $iqgain=$_POST['crystals']*$set['ct_iqpercrys']; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']} WHERE userid=$userid"); $db->query("UPDATE userstats SET IQ=IQ+$iqgain WHERE userid=$userid"); print "You traded {$_POST['crystals']} Points for $iqgain IQ."; } } else if($_GET['spend'] == 'money') { print "Type in the amount of Points you want to swap for money. You have [b]{$ir['crystals']}[/b] Points. One Point = \$".number_format($set['ct_moneypercrys']).".<form action='usepoints.php?spend=money2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'money2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough Points or did not fill out the form. [url='usepoints.php?spend=money']Back[/url]"; } else { $iqgain=$_POST['crystals']*$set['ct_moneypercrys']; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$iqgain WHERE userid=$userid"); print "You traded {$_POST['crystals']} Points for \$".number_format($iqgain)."."; } if($_GET['spend'] == 'searches') { if($ir['crystals'] < 15); { echo "You don't have enough Points!"; } else { echo "You have paid 15 Points to refill searches."; $do = sprintf("UPDATE users SET turns = 50, crystals = crystals - 15 WHERE userid = %u",($userid)); $db->query($do); } } } } $h->endpage(); ?> Quote
Guest Anonymous Posted April 11, 2009 Posted April 11, 2009 Re: yet another problem if($_GET['spend'] == 'searches') { if($ir['crystals'] < 15); { echo "You don't have enough Points!"; } else { echo "You have paid 15 Points to refill searches."; $do = sprintf("UPDATE users SET turns = 50, crystals = crystals - 15 WHERE userid = %u",($userid)); $db->query($do); } } small typo in that, added a ; after the less than operator. if($_GET['spend'] == 'searches'){ if($ir['crystals'] < 15){ echo 'You do not have enough crystals.'; }else{ echo 'You have paid 15 crystals to refill your searches.'; $db->query("update users set turns = 50, crystals = crystals - 15 where userid = '$userid'"); } } Quote
noddy Posted April 11, 2009 Author Posted April 11, 2009 Re: yet another problem okay ty zeon, your fix got the page working, but when i click refill searches , nothing happens Quote
Guest Anonymous Posted April 11, 2009 Posted April 11, 2009 Re: yet another problem Does the message appear "You have paid 15 x to refill your searches" if not, make sure you have the correct URL. Quote
AlabamaHit Posted April 11, 2009 Posted April 11, 2009 Re: yet another problem lol i see that now lol stupid semi colons lol Quote
noddy Posted April 11, 2009 Author Posted April 11, 2009 Re: yet another problem nothing appears? Quote
AlabamaHit Posted April 11, 2009 Posted April 11, 2009 Re: yet another problem <?php include "globals.php"; if(!$_GET['spend']) { print "Welcome to the Points temple! You have [b]{$ir['crystals']}[/b] Points. What would you like to spend your Points on? [url='usepoints.php?spend=refill']Energy Refill - {$set['ct_refillprice']} Points[/url] [url='usepoints.php?spend=IQ']IQ - {$set['ct_iqpercrys']} IQ per Point[/url] [url='usepoints.php?spend=money']Money - ¥".number_format($set['ct_moneypercrys'])." per Point[/url] [url='usepoints.php?spend=searches']Refill Searches -15 points[/url] "; } else { if($_GET['spend'] == 'refill') { if($ir['crystals'] <$set['ct_refillprice']) { print "You don't have enough Points!"; } else if($ir['energy'] == $ir['maxenergy']) { print "You already have full energy."; } else { $db->query("UPDATE users SET energy=maxenergy,crystals=crystals-{$set['ct_refillprice']} WHERE userid=$userid"); print "You have paid {$set['ct_refillprice']} Points to refill your energy bar."; } } else if($_GET['spend'] == 'IQ') { print "Type in the amount of Points you want to swap for IQ. You have [b]{$ir['crystals']}[/b] Points. One Point = {$set['ct_iqpercrys']} IQ.<form action='usepoints.php?spend=IQ2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'IQ2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough Points or did not fill out the form. [url='usepoints.php?spend=IQ']Back[/url]"; } else { $iqgain=$_POST['crystals']*$set['ct_iqpercrys']; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']} WHERE userid=$userid"); $db->query("UPDATE userstats SET IQ=IQ+$iqgain WHERE userid=$userid"); print "You traded {$_POST['crystals']} Points for $iqgain IQ."; } } else if($_GET['spend'] == 'money') { print "Type in the amount of Points you want to swap for money. You have [b]{$ir['crystals']}[/b] Points. One Point = \$".number_format($set['ct_moneypercrys']).".<form action='usepoints.php?spend=money2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'money2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough Points or did not fill out the form. [url='usepoints.php?spend=money']Back[/url]"; } else { $iqgain=$_POST['crystals']*$set['ct_moneypercrys']; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$iqgain WHERE userid=$userid"); print "You traded {$_POST['crystals']} Points for \$".number_format($iqgain)."."; } } else if($_GET['spend'] == 'searches') { if($ir['crystals'] < 15) { echo "You don't have enough Points!"; } else { echo "You have paid 15 Points to refill searches."; $do = sprintf("UPDATE users SET turns = 50, crystals = crystals - 15 WHERE userid = %u",($userid)); $db->query($do); } } } $h->endpage(); ?> Quote
noddy Posted April 12, 2009 Author Posted April 12, 2009 Re: yet another problem yep, that did it alabama, thank all of you guys for helping me.... again, damn -sure shows i need to practice >.< Quote
DELETE ME NOW! Posted April 12, 2009 Posted April 12, 2009 Re: yet another problem He just forgot the else like elseif Quote
AlabamaHit Posted April 12, 2009 Posted April 12, 2009 Re: yet another problem Yeah it was just minor...i hate the small stuff like that lol makes it hard to find lol Quote
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.