Jump to content
MakeWebGames

Recommended Posts

Posted

heya all, just wondering if you could gimmie a hand with this error,

Parse error: syntax error, unexpected T_ELSE in /home/username/public_html/game/job.php on line 58

 

<?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 "<table width='75%' border='1' cellspacing='0'>
 <tr>
   <td width='13%'>Job Name:</td>
   <td width='87%'>{$r['jNAME']}</td>
 </tr>
 <tr>
   <td width='13%'>Job Owner:</td>
   <td width='87%'>{$r['jOWNER']}</td>
 </tr>
 <tr>
   <td width='13%'>Job Description:</td>
   <td width='87%'>{$r['jDESC']}</td>
 </tr>
 <tr>
   <td colspan='2' align='center'>[url='job.php?interview={$r[']Go To The Interview[/url]</td>
 </tr>
</table>
";
}
}
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 "<table width='75%' border='0'>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>So {$ir['username']}, you were looking for a job with us?</td>
 </tr>
 <tr>
   <td width='13%'>{$ir['username']}:</td>
   <td width='87%'>Yes I was.</td>
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>Okay {$ir['username']}, we have look at you profile and we welcome you aboard our team.</td>
 </tr>
 <tr>
   <td width='13%'>{$ir['username']}:</td>
   <td width='87%'>Thank you! :)</td>
 </tr>
 <tr>
   <td colspan='2' align='center'>[url='job.php']Check Out Your New Job![/url]</td>
 </tr>
</table>";
 }
 else
 {
 print "<table width='75%' border='0'>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>Sorry {$ir['username']}, we have looked at your profile and your you are just not good enough.</td>
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>To be able to work your first job you'll need:</td>
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>";
 if($ir['endurance'] < $r['jrENDN'])
 {
 $s=$r['jrENDN']-$ir['endurance'];
 print "<td width='87%'>$s more endurance</td>";
 }
 print "
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>";
 if($ir['labour'] < $r['jrLABN'])
 {
 $s=$r['jrLABN']-$ir['labour'];
 print "<td width='87%'>$s more labour</td>";
 }
 print "
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>";
 if($ir['IQ'] < $r['jrIQN'])
 {
 $s=$r['jrIQN']-$ir['IQ'];
 print "<td width='87%'>$s more IQ</td>";
 }
 print "
 </tr>
 <tr>
 <td width='13%'>{$r['jOWNER']}:</td>
   <td>Before you can work here. Try again another time.</td>
 </tr>
 <tr>
   <td colspan='2' align='center'>[url='index.php']Sorry Go Back Home![/url]</td>
   </tr>
</table>";
}
}
}
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 "<center>
 <h3>Your Job</h3>
 You currently work in the {$ir['jNAME']}! You receive \${$ir['jrPAY']} each day at 12am!

 You also receive {$ir['jrIQG']} IQ, {$ir['jrENDG']} endurance, and {$ir['jrLABG']} labour!


 <table width='75%' border='1' cellspacing='0'>
   <tr>
     <td width='50%'>Endurance: {$ir['endurance']}</td>
     <td width='50%'>IQ: {$ir['IQ']}</td>
   </tr>
   <tr>
     <td>Labour: {$ir['labour']}</td>
     <td>Job Rank: {$ir['jrNAME']}</td>
   </tr>
 </table>

   [b]<u>Job Ranks</u>[/b]


 <table width='75%' border='1' cellspacing='0'>
   <tr>
     <td width='20%' align='center'>[b]Job Title[/b]</td>
     <td width='20%' align='center'>[b]Job Pay[/b]</td>
     <td width='20%' align='center'>[b]Endurance Reqd[/b]</td>
     <td width='20%' align='center'>[b]IQ Reqd[/b]</td>
     <td width='20%' align='center'>[b]Labour Reqd[/b]</td>
   </tr>";
$q=$db->query("SELECT * FROM jobranks WHERE jrJOB={$ir['job']} ORDER BY jrPAY ASC;");
while($r=$db->fetch_row($q))
{
print "<tr>
     <td align='center'>{$r['jrNAME']}</td>
     <td align='center'>\${$r['jrPAY']}</td>
     <td align='center'>{$r['jrENDN']}</td>
     <td align='center'>{$r['jrIQN']}</td>
     <td align='center'>{$r['jrLABN']}</td>
   </tr>";
}
print "</table>
 </center>


[url='job.php?action=promote']> Try To Get Promoted[/url]

[url='job.php?action=quit']> Quit[/url]";
}

function job_promote()
{
global $db,$ir,$c,$userid,$h;
$q=$db->query("SELECT * FROM jobranks WHERE jrPAY > {$ir['jrPAY']} AND jrENDN <= {$ir['endurance']} AND jrLABN <= {$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 at this time.

[url='job.php']> Back[/url]";
}
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']}

[url='job.php']> Back[/url]";
}
}
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!

[url='job.php']> Back[/url]";
}
$h->endpage();
?>
Posted

Re: Some help with jobs.php error

 

:) they worked but once you click get the job it doesnt take you to the job page just take you back to the interview page :(

i knew it was going to work... i gave you a starting point, try to fix up the rest ;)

Posted

Re: Some help with jobs.php error

lol its fixed XD :)

 

<?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 "<table width='75%' border='1' cellspacing='0'>
 <tr>
   <td width='13%'>Job Name:</td>
   <td width='87%'>{$r['jNAME']}</td>
 </tr>
 <tr>
   <td width='13%'>Job Owner:</td>
   <td width='87%'>{$r['jOWNER']}</td>
 </tr>
 <tr>
   <td width='13%'>Job Description:</td>
   <td width='87%'>{$r['jDESC']}</td>
 </tr>
 <tr>
   <td colspan='2' align='center'>[url='job.php?interview={$r[']Go To The Interview[/url]</td>
 </tr>
</table>
";
}
}
elseif ($_GET['interview'])
{
$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 "<table width='75%' border='0'>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>So {$ir['username']}, you were looking for a job with us?</td>
 </tr>
 <tr>
   <td width='13%'>{$ir['username']}:</td>
   <td width='87%'>Yes I was.</td>";
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 "
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>Okay {$ir['username']}, we have look at you profile and we welcome you aboard our team.</td>
 </tr>
 <tr>
   <td width='13%'>{$ir['username']}:</td>
   <td width='87%'>Thank you! :)</td>
 </tr>
 <tr>
   <td colspan='2' align='center'>[url='job.php']Check Out Your New Job![/url]</td>
 </tr>
</table>";
 }
 else
 {
 print "<table width='75%' border='0'>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>Sorry {$ir['username']}, we have looked at your profile and your you are just not good enough.</td>
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>
   <td width='87%'>To be able to work your first job you'll need:</td>
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>";
 if($ir['strength'] < $r['jrSTRN'])
 {
 $s=$r['jrSTRN']-$ir['strength'];
 print "<td width='87%'>$s more strength</td>";
 }
 print "
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>";
 if($ir['labour'] < $r['jrLABOURN'])
 {
 $s=$r['jrLABOURN']-$ir['labour'];
 print "<td width='87%'>$s more labour</td>";
 }
 print "
 </tr>
 <tr>
   <td width='13%'>{$r['jOWNER']}:</td>";
 if($ir['IQ'] < $r['jrIQN'])
 {
 $s=$r['jrIQN']-$ir['IQ'];
 print "<td width='87%'>$s more IQ</td>";
 }
 print "
 </tr>
 <tr>
 <td width='13%'>{$r['jOWNER']}:</td>
   <td>Before you can work here. Try again another time.</td>
 </tr>
 <tr>
   <td colspan='2' align='center'>[url='job.php']Sorry Go Back And Look For More Jobs![/url]</td>
   </tr>
</table>";
}
}
}
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 "<center>
 <h3>Your Job</h3>
 You currently work in the {$ir['jNAME']}! You receive \${$ir['jrPAY']} each day at 12am!

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


 <table width='75%' border='1' cellspacing='0'>
   <tr>
     <td width='50%'>Strength: {$ir['strength']}</td>
     <td width='50%'>IQ: {$ir['IQ']}</td>
   </tr>
   <tr>
     <td>Labour: {$ir['labour']}</td>
     <td>Job Rank: {$ir['jrNAME']}</td>
   </tr>
 </table>

   [b]<u>Job Ranks</u>[/b]


 <table width='75%' border='1' cellspacing='0'>
   <tr>
     <td width='20%' align='center'>[b]Job Title[/b]</td>
     <td width='20%' align='center'>[b]Job Pay[/b]</td>
     <td width='20%' align='center'>[b]Strength Reqd[/b]</td>
     <td width='20%' align='center'>[b]IQ Reqd[/b]</td>
     <td width='20%' align='center'>[b]Labour Reqd[/b]</td>
   </tr>";
$q=$db->query("SELECT * FROM jobranks WHERE jrJOB={$ir['job']} ORDER BY jrPAY ASC;");
while($r=$db->fetch_row($q))
{
print "<tr>
     <td align='center'>{$r['jrNAME']}</td>
     <td align='center'>\${$r['jrPAY']}</td>
     <td align='center'>{$r['jrSTRN']}</td>
     <td align='center'>{$r['jrIQN']}</td>
     <td align='center'>{$r['jrLABOURN']}</td>
   </tr>";
}
print "</table>
 </center>


[url='job.php?action=promote']> Try To Get Promoted[/url]

[url='job.php?action=quit']> Quit[/url]";
}

function job_promote()
{
global $db,$ir,$c,$userid,$h;
$q=$db->query("SELECT * FROM jobranks WHERE jrPAY > {$ir['jrPAY']} AND jrSTRN <= {$ir['endurance']} 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 at this time.

[url='job.php']> Back[/url]";
}
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']}

[url='job.php']> Back[/url]";
}
}
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!

[url='job.php']> Back[/url]";
}
$h->endpage();
?>

 

For others to use :) if they want XD

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