I have this script for my game where they can change there race. This will cost them 2,500 points. However in our database points are called crystals.
If the person has 500 points, and the script takes 2,500 it will put them at -2,000 points. I need the script to tell them they dont have enough points and then not change there race because they dont have enough to do so. However im not to sure on how I would write it.
This is the race change script im editing, can anyone explain how to write this to do what I need:
Code: function conf_race_change()
{
global $ir,$c,$userid,$h;
if($ir['race'] == "Pirate") { $r="Ninja"; } else { $r="Pirate"; }
print "Switching your race will cost 2,500 points. Are you sure you want to become a $r?<br />
<a href='preferences.php?action=racechange2'>Yes</a> | <a href='preferences.php'>No</a>";
}
function do_race_change()
{
global $db,$ir,$c,$userid,$h;
if($ir['race'] == "Pirate") { $r="Ninja"; } else { $r="Pirate"; }
$db->query("UPDATE users SET race='$r' WHERE userid=$userid");
$db->query("UPDATE users SET crystals=crystals-2500 WHERE userid=$userid");
print "Success, you are now $r!<br />
<a href='preferences.php'>Back</a>";
}
difference between datetimes
($row['totime']-$row['fromtime'])/60this is giving me 0example of totime and fromtime are:2009-12-26 01:10:05 and 2009-12-26 1:03:01i was thinking that with those values i would end up with something
TimeZoneOffset
Hello,Please i need your help. I have a system that users can use to punch in and out. This system has been working fine however the time went one hour behind on sunday and since then the system has
! = ''
In the following 'IF' statement if v_ompcat = PU for example then Oracle equates that 'IF' statement to NOT TRUE and skips onto the next 'IF' satement whereas I would have thought that it would have
getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work with?Ex:$url="http://www.google.com"$sourcecode=magicfunction($url);//so that i could
Transport data between itab and textfield on ALV event
Hallo,
Customizing message/behavior
Hi,I'm using the ASP.NET membership/authorization controls in my application. Some parts of my application are reserved for users who are in certain roles i.e. editor, writer, etc. I control this with
LSB (PHP 5.3) problem with static value!
hello,i'm having a problem. static::$text variable gets lost at some point. can someone please correct and explain it to me?Line number On/Off| Expand/Contract <?phpclass A { protected
SAP BCS. BPS
Hi all,
How to submit a form to the same page?
I have a table containing information about books in my library and this table has the following columns: id, title, category. What I want to do is to make a form that will allow me to sort these
Login script (probably a simple error)
dbConfig.phpCode: <?// Replace the variable values below// with your specific database information.$host = "localhost";$user = "username";$pass = "password";$db