Jump to content

Why dont it work


jlaursen

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.