Jump to content
MakeWebGames

Recommended Posts

Posted

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?

Posted

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);
}
}
Posted

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();
?>
Guest Anonymous
Posted

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'");
}
}
Guest Anonymous
Posted

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.

Posted

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();
?>
Posted

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

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.   Paste as plain text instead

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