jlaursen Posted June 30, 2010 Share Posted June 30, 2010 Im makeing a textbased game and for job, i have this code to make sure that you meet the requermetns. For some reason its not working Can someone please debug this? if(($do == take)&&($jobid == 6)) { if(($str < 17)&&($iq < 20)&&($lvl < 7)&&($agi < 15)) { header('Refresh: 2.5; url=job.php'); echo "<h3>You Did not meet the requerments</h3>"; } else { mysql_select_db("$db", $con); mysql_query("UPDATE users SET job = '$jobid' WHERE name = '$name'"); mysql_close($con); echo "<h3>You Have Taken Your Job</h3>"; echo "<a href=job.php>Go Back To Jobs</a>"; exit; } } Quote Link to comment https://forums.phpfreaks.com/topic/206305-why-dont-it-work/ Share on other sites More sharing options...
awjudd Posted June 30, 2010 Share Posted June 30, 2010 Please define 'not working' ... can't debug without information. ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/206305-why-dont-it-work/#findComment-1079257 Share on other sites More sharing options...
kenrbnsn Posted June 30, 2010 Share Posted June 30, 2010 You have to help us. What are the requirements? What is not working in your script? One obvious error in your code is that strings need to be quoted. Instead of <?php if(($do == take)&&($jobid == 6)) { ?> do <?php if(($do == 'take')&&($jobid == 6)) { ?> unless "take" is a constant. Ken Quote Link to comment https://forums.phpfreaks.com/topic/206305-why-dont-it-work/#findComment-1079258 Share on other sites More sharing options...
jlaursen Posted June 30, 2010 Author Share Posted June 30, 2010 The requerments are set from the core, where its taken from the database. Take is the action sent from the from. $do = $_GET['do']; $jobid = $_GET['jobid']; The requerments are: if(($str < 17)&&($iq < 20)&&($lvl < 7)&&($agi < 15)) { header('Refresh: 2.5; url=job.php'); echo "<h3>You Did not meet the requerments</h3>"; } $str, $iq, $lvl, and $agi are set in the core, taken from the mysql database Quote Link to comment https://forums.phpfreaks.com/topic/206305-why-dont-it-work/#findComment-1079259 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.