Jump to content
MakeWebGames

Recommended Posts

Posted

does anyone know what is wrong here it dosent tell the pleyr how much point he recives each day this is what is says

You currently work in the Medical! You receive $900 and Job Points

 

You currently work in the {$ir['jNAME']}! You receive \${$ir['jrPAY']} and {$ir['jrPOINTS']} Job Points
Posted

Re: does anyone know how to sort this

 

let me guess... jrPOINTS doesn't exist on users table or it's empty...

yep it does exist lol and still the same

Posted

Re: does anyone know how to sort this

 

Post all of your job script,

either your not selecting it in a SELECT query or the table maybe empty

let me say something... $ir[] comes from a SELECT * ... my point... if it's there... it is selected, what might be happening as jrPOINTS is present on the DB is jrPOINTS is not JOINED to the $ir query.

Posted

Re: does anyone know how to sort this

this is my job script

<?php

$jobquery=1;

include "globals.php";

$_GET['interview'] = abs((int) $_GET['interview']);

if(!$ir['job'])

{

if(!$_GET['interview'])

{

print "You do not yet have a job. A list of jobs is available below.

";

$q=$db->query("SELECT * FROM jobs");

while($r=$db->fetch_row($q))

{

print "> {$r['jNAME']} - {$r['jDESC']} - Go to interview

";

}

}

else

{

$q=$db->query("SELECT j.*,jr.* FROM jobs j LEFT JOIN jobranks jr ON j.jFIRST = jr.jrID WHERE j.jID={$_GET['interview']}");

$r=$db->fetch_row($q);

print "{$r['jOWNER']}: So {$ir['username']}, you were looking for a job with us?

{$ir['username']}: Yes please!

";

if($ir['strength'] >= $r['jrSTRN'] && $ir['labour'] >= $r['jrLABOURN'] && $ir['IQ'] >= $r['jrIQN'])

{

$db->query("UPDATE users SET job={$_GET['interview']},jobrank={$r['jrID']} WHERE userid=$userid;");

print "{$r['jOWNER']}: Okay {$ir['username']}, we're good to go, see you tomorrow.

{$ir['username']}: Thanks!

Start your job";

}

else

{

print "{$r['jOWNER']}: Sorry {$ir['username']}, you're not far enough in the game to work in this job. You'll need:";

if($ir['strength'] < $r['jrSTRN'])

{

$s=$r['jrSTRN']-$ir['strength'];

print " $s more strength, ";

}

if($ir['labour'] < $r['jrLABOURN'])

{

$s=$r['jrLABOURN']-$ir['labour'];

print " $s more labour, ";

}

if($ir['IQ'] < $r['jrIQN'])

{

$s=$r['jrIQN']-$ir['IQ'];

print " $s more IQ, ";

}

print "before you'll be able to work here!

:'(";

}

}

}

else

{

switch($_GET['action'])

{

case 'quit':

quit_job();

break;

case 'promote':

job_promote();

break;

default:

job_index();

break;

}

}

function job_index()

{

global $db, $ir,$c,$userid,$h;

print "<h3>Your Job</h3>

You currently work in the {$ir['jNAME']}! You receive \${$ir['jrPAY']} and {$ir['jrPOINTS']} Job Points

You also receive {$ir['jrIQG']} IQ, {$ir['jrSTRG']} strength, and {$ir['jrLABOURG']} labour!

<table width=80% class='table'><tr><td>Job Points:{$ir['jobpoints']} <tr><td>Strength: {$ir['strength']}</td><td>IQ: {$ir['IQ']}</tr></td><tr><td>Labour: {$ir['labour']}</td><td>Job Rank: {$ir['jrNAME']}</td></tr></table>

<table width=80% cellspacing=1 class='table'><tr style='background:gray'><th>Title</th><th>Pay</th><th>Strength Reqd</th><th>IQ Reqd</th><th>Labour Reqd</th></tr>";

$q=$db->query("SELECT * FROM jobranks WHERE jrJOB={$ir['job']} ORDER BY jrPAY ASC;");

while($r=$db->fetch_row($q))

{

print "<tr><td>{$r['jrNAME']}</td><td>\${$r['jrPAY']}</td><td>{$r['jrSTRN']}</td><td>{$r['jrIQN']}</td><td>{$r['jrLABOURN']}</td></tr>";

}

$js=$db->query("SELECT * FROM jobspecials WHERE jsJOB={$ir['job']} ORDER BY jsID ASC;",$c);

print "Job Ranks

<form action='specials.php' method='post'>

<table width=80% cellspacing=1 class='table'> <tr> <th><font color=white>Job Specials</font></th> <th><font color=white>Cost</font></th> <th><font color=white>Take</font></th></tr>";

if($db->num_rows($js) == 0)

{

print "<tr class='row$current_row'><td colspan=3>This Job has no Speacials</td></tr>";

$current_row = 1 - $current_row;

}

while($sp=$db->fetch_row($js))

{

print "<tr class='row$current_row'><td><font color=black>{$sp['jsNAME']}</td><td><font color=#FF0000>-{$sp['jsCOST']} Job Points</font></td><td><center><input type='radio' name='ID' value='{$sp['jsID']}' /></td></tr>";

$current_row = 1 - $current_row;

}

print "<tr>

<td colspan=3><div align=center><input type='submit' value='Purchase'></div></td>

</tr></table></form>";

print "</table>

> Try To Get Promoted

> Quit";

}

function job_promote()

{

global $db,$ir,$c,$userid,$h;

$q=$db->query("SELECT * FROM jobranks WHERE jrPAY > {$ir['jrPAY']} AND jrSTRN <= {$ir['strength']} AND jrLABOURN <= {$ir['labour']} AND jrIQN <= {$ir['IQ']} AND jrJOB = {$ir['job']} ORDER BY jrPAY DESC LIMIT 1");

if($db->num_rows($q) == 0)

{

print "Sorry, you cannot be promoted.

> Back";

}

else

{

$r=$db->fetch_row($q);

$db->query("UPDATE users SET jobrank={$r['jrID']} WHERE userid=$userid");

print "Congrats, you have been promoted to {$r['jrNAME']}

> Back";

}

}

function quit_job()

{

global $db,$ir,$c,$userid,$h;

$db->query("UPDATE users SET job=0,jobrank=0 WHERE userid=$userid");

print "You have quit your job!

> Back";

}

$h->endpage();

?>

Posted

Re: does anyone know how to sort this

Could it be because higher up in the script when the player gets a job the data base isn't setting his points, only his pay?

 

$db->query("UPDATE users SET job={$_GET['interview']},jobrank={$r['jrID']} WHERE userid=$userid;");

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