Butch_ben Posted April 5, 2006 Share Posted April 5, 2006 hiim creating an online mafia game using php and mysql and im not sure how to perform this code <?$username = $_SESSION["username"];$query_general ="SELECT * FROM users WHERE username ='$username'";$object_general = mysql_fetch_object(mysql_query($query_general));$points=$object_general->points;if($_POST[crime] == 1 && $points >= '0'){echo"<center> Success! <br> You set up your stool and went un noticed for the whole day. <br> You earned a nice sum of £ $crime1 </center>";}else{ echo"<center> Failure! <br> If you cant do that crime you might as well suicide now</center>";} if ($result == 'true' "$gold"+"$crime1") ?> the error is if ($result == 'true' "$gold"+"$crime1") i need the code to add money ($crime1) to the money on their user area ($gold) if they succeed in the crime and also add points to their user ($points)can somebody please help me with this? i can elaberate more if neededthanks Link to comment Share on other sites More sharing options...
pulpfiction Posted April 5, 2006 Share Posted April 5, 2006 Hi,To add 2 numbers..(if thats what you are looking for)I guess when you said "succeed in the crime" is true when $result is true if ($result == "true"){$total = $gold + $crime1;$points = $points + $total} Link to comment Share on other sites More sharing options...
Butch_ben Posted April 5, 2006 Author Share Posted April 5, 2006 Hi,To add 2 numbers..(if thats what you are looking for)I guess when you said "succeed in the crime" is true when $result is true if ($result == "true"){$total = $gold + $crime1;$points = $points + $total}<{POST_SNAPBACK}> hmm still got a parse error on lone 266 which is just a single } O.o Link to comment Share on other sites More sharing options...
Butch_ben Posted April 5, 2006 Author Share Posted April 5, 2006 hmm still got a parse error on lone 266 which is just a single } O.o<{POST_SNAPBACK}> no worriessorted that outbut the code isnt doing the job :Sit doesnt add the money from the success to the users money Link to comment Share on other sites More sharing options...
pulpfiction Posted April 5, 2006 Share Posted April 5, 2006 Addition is pretty much straight forward, it will just add two numbers, but we have to check if it goes inside the if loop... check for the value of $result and see if its "true"... I dont see anyother problem if its a normal sum of two numbers. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now