Jump to content
MakeWebGames

Got some issue when creating job


septrax
 Share

Recommended Posts

Hi

I moved my game to another server a few minutes ago and i think i messeup up something with the job sql

After i moved my game i added some new stuff no problems at all until i was adding a few new job i saw i got some sql error wic i did not get before :/

SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' , , , , , )' at line 1

Query was INSERT INTO jobranks VALUES('', '', 2, , , , , , , )

I have no idea what could make this worked perfect before :(

So does anybody have any idea what i can do to fix it ?

Thanks

Link to comment
Share on other sites

Re: Got some issue when creating job

Hmm sorry about this but im not really sure were i have looked trough the code but cant see were it missing :/

Here is my file my friend tooked a closer look but was a bit in a rush so he couldent help me so much :(

Anyhow thansk for help :)

 

staff_jobs.php

<?php
include "sglobals.php";
if($ir['user_level'] > 2)
{
die("403");
}
//This contains shop stuffs
switch($_GET['action'])
{
case 'newjob': newjob(); break;
case 'jobedit': jobedit(); break;
case 'newjobrank': newjobrank(); break;
case 'jobrankedit': jobrankedit(); break;
case 'jobdele': jobdele(); break;
case 'jobrankdele': jobrankdele(); break;
default: print "Error: This script requires an action."; break;
}
function newjob()
{
global $db,$ir,$userid;
if ( $_POST['jNAME']) {
$db->query("INSERT INTO jobs VALUES('','{$_POST['jNAME']}', 0, '{$_POST['jDESC']}', '{$_POST['jOWNER']}')");
$i=$db->insert_id();
$db->query("INSERT INTO jobranks VALUES('', '{$_POST['jrNAME']}', $i, {$_POST['jrPAY']}, {$_POST['jrIQG']}, {$_POST['jrLABOURG']}, {$_POST['jrSTRG']}, {$_POST['jrIQN']}, {$_POST['jrLABOURN']}, {$_POST['jrSTRN']})");
$j=$db->insert_id();
$db->query("UPDATE jobs SET jFIRST=$j WHERE jID=$i");
print "Job created!

";
}
else {
print <<<EOF
<form action='staff_jobs.php?action=newjob' method='post'>
[b]Job Name:[/b] <input type='text' name='jNAME' />

[b]Job Description:[/b] <input type='text' name='jDESC' />

[b]Job Owner:[/b] <input type='text' name='jOWNER' />

<hr>[b]First Job Rank:[/b]

[b]Rank Name:[/b] <input type='text' name='jrNAME' />

[b]Pays:[/b] <input type='text' name='jrPAY' />

[b]Gains:[/b] Str: <input type='text' name='jrSTRG' size=3 maxlength=3> Lab: <input type='text' name='jrLABOURG' size=3 maxlength=3> IQ: <input type='text' name='jrIQG' size=3 maxlength=3>

[b]Reqs:[/b] Str: <input type='text' name='jrSTRN' size=5 maxlength=5> Lab: <input type='text' name='jrLABOURN' size=5 maxlength=5> IQ: <input type='text' name='jrIQN' size=5 maxlength=5>

<input type='submit' value='Create Job' /></form>
EOF;
}
}
function jobedit()
{
global $db,$ir,$userid;
if ( $_POST['stage2']) {
$db->query("UPDATE jobs SET jNAME='{$_POST['jNAME']}', jDESC='{$_POST['jDESC']}', jOWNER='{$_POST['jOWNER']}', jFIRST={$_POST['jFIRST']} WHERE jID={$_POST['jID']}");
print "Job updated!

";
}
else if ( $_POST['stage1']) {
$q=$db->query("SELECT * FROM jobs WHERE jID={$_POST['jID']}");
$r=$db->fetch_row($q);
print <<<EOF
<form action='staff_jobs.php?action=jobedit' method='post'>
<input type='hidden' name='stage2' value='1'>
<input type='hidden' name='jID' value='{$_POST['jID']}'>
[b]Job Name:[/b] <input type='text' name='jNAME' value='{$r['jNAME']}'>

[b]Job Description:[/b] <input type='text' name='jDESC' value='{$r['jDESC']}'>

[b]Job Owner:[/b] <input type='text' name='jOWNER' value='{$r['jOWNER']}'>

[b]First Job Rank:[/b] 
EOF;
print jobrank_dropdown($c,'jFIRST',$r['jFIRST']);
print <<<EOF


<input type='submit' value='Edit' />
</form>
EOF;
}
else
{
print <<<EOF
<form action='staff_jobs.php?action=jobedit' method='post'>
<input type='hidden' name='stage1' value='1'>
Select a job to edit.

EOF;
print job_dropdown($c, 'jID', -1);
print <<<EOF


<input type='submit' value='Edit Job' />
</form>
EOF;
}
}
function newjobrank()
{
global $db,$ir,$userid;
if ( $_POST['jrNAME']) {
$db->query("INSERT INTO jobranks VALUES('', '{$_POST['jrNAME']}', {$_POST['jrJOB']}, {$_POST['jrPAY']}, {$_POST['jrIQG']}, {$_POST['jrLABOURG']}, {$_POST['jrSTRG']}, {$_POST['jrIQN']}, {$_POST['jrLABOURN']}, {$_POST['jrSTRN']})");
print "Job rank created!

";
}
else {
print <<<EOF
<form action='staff_jobs.php?action=newjobrank' method='post'>
[b]Rank Name:[/b] <input type='text' name='jrNAME' />

[b]Pays:[/b] <input type='text' name='jrPAY' />

[b]Job:[/b] 
EOF;
print job_dropdown($c,"jrJOB", -1);
print <<<EOF


[b]Gains:[/b] Str: <input type='text' name='jrSTRG' size=3 maxlength=3> Lab: <input type='text' name='jrLABOURG' size=3 maxlength=3> IQ: <input type='text' name='jrIQG' size=3 maxlength=3>

[b]Reqs:[/b] Str: <input type='text' name='jrSTRN' size=5 maxlength=5> Lab: <input type='text' name='jrLABOURN' size=5 maxlength=5> IQ: <input type='text' name='jrIQN' size=5 maxlength=5>

<input type='submit' value='Create Job Rank' /></form>
EOF;
}
}
function jobrankedit()
{
global $db,$ir,$userid;
if ( $_POST['stage2']) {
$db->query("UPDATE jobranks SET jrNAME='{$_POST['jrNAME']}', jrJOB = {$_POST['jrJOB']}, jrPAY= {$_POST['jrPAY']}, jrIQG={$_POST['jrIQG']}, jrLABOURG={$_POST['jrLABOURG']}, jrSTRG={$_POST['jrSTRG']}, jrIQN={$_POST['jrIQN']}, jrLABOURN={$_POST['jrLABOURN']}, jrSTRN={$_POST['jrSTRN']}WHERE jrID={$_POST['jrID']}");
print "Job rank updated!

";
}
else if ( $_POST['stage1']) {
$q=$db->query("SELECT * FROM jobranks WHERE jrID={$_POST['jrID']}");
$r=$db->fetch_row($q);
print <<<EOF
<form action='staff_jobs.php?action=jobrankedit' method='post'>
<input type='hidden' name='stage2' value='1'>
<input type='hidden' name='jrID' value='{$_POST['jrID']}'>
[b]Job Rank Name:[/b] <input type='text' name='jrNAME' value='{$r['jrNAME']}'>

[b]Job:[/b] 
EOF;
print job_dropdown($c,'jrJOB',$r['jrJOB']);
print <<<EOF


[b]Pays:[/b] <input type='text' name='jrPAY' value='{$r['jrPAY']}' />

[b]Gains:[/b] Str: <input type='text' name='jrSTRG' size=3 maxlength=3 value='{$r['jrSTRG']}'> Lab: <input type='text' name='jrLABOURG' size=3 maxlength=3 value='{$r['jrLABOURG']}'> IQ: <input type='text' name='jrIQG' size=3 maxlength=3 value='{$r['jrIQG']}'>

[b]Reqs:[/b] Str: <input type='text' name='jrSTRN' size=5 maxlength=5 value='{$r['jrSTRN']}'> Lab: <input type='text' name='jrLABOURN' size=5 maxlength=5 value='{$r['jrLABOURN']}'> IQ: <input type='text' name='jrIQN' size=5 maxlength=5 value='{$r['jrIQN']}'>

[b]Job:[/b]
<input type='submit' value='Edit' />
</form>
EOF;
}
else
{
print <<<EOF
<form action='staff_jobs.php?action=jobrankedit' method='post'>
<input type='hidden' name='stage1' value='1'>
Select a job rank to edit.

EOF;
print jobrank_dropdown($c, 'jrID', -1);
print <<<EOF


<input type='submit' value='Edit Job Rank' />
</form>
EOF;
}
}
function jobrankdele()
{
global $db,$ir,$userid;
if ( $_POST['stage1']) {
$q=$db->query("SELECT * FROM jobranks WHERE jrID={$_POST['jrID']}");
$jr=$db->fetch_row($q);
$_POST['jID']=$jr['jrJOB'];
$db->query("DELETE FROM jobranks WHERE jrID={$_POST['jrID']}");
print "Job rank successfully deleted!
";
$db->query("UPDATE users u LEFT JOIN jobs j ON u.job=j.jID SET u.jobrank=j.jFIRST WHERE u.job={$_POST['jID']} and u.jobrank={$_POST['jrID']}");
$q=$db->query("SELECT * FROM jobs WHERE jFIRST={$_POST['jrID']}");
if($db->num_rows($q))
{
$r=$db->fetch_row($q);
print "[b]Warning![/b] The Job {$r['jNAME']} now has no first rank! Please go edit it and include a first rank.
";

}
}
else
{
print <<<EOF
<form action='staff_jobs.php?action=jobrankdele' method='post'>
<input type='hidden' name='stage1' value='1'>
Select a job rank to delete.

EOF;
print jobrank_dropdown($c, 'jrID', -1);
print <<<EOF


<input type='submit' value='Delete Job Rank' />
</form>
EOF;
}
}
function jobdele()
{
global $db,$ir,$userid;
if ( $_POST['stage1']) {
$db->query("DELETE FROM jobs WHERE jID={$_POST['jID']}");
print "Job rank successfully deleted!
";
$db->query("DELETE FROM jobranks WHERE jrJOB={$_POST['jID']}");
print mysql_affected_rows()." job ranks deleted.
";
$db->query("UPDATE users SET job=0,jobrank=0 WHERE job={$_POST['jID']}");
}
else
{
print <<<EOF
<form action='staff_jobs.php?action=jobdele' method='post'>
<input type='hidden' name='stage1' value='1'>
Select a job to delete.

EOF;
print job_dropdown($c, 'jID', -1);
print <<<EOF


<input type='submit' value='Delete Job' />
</form>
EOF;
}
}
function report_clear()
{
global $db,$db,$ir,$c,$h,$userid;
if($ir['user_level'] > 3)
{
die("403");
}
$_GET['ID'] = abs((int) $_GET['ID']);
stafflog_add("Cleared player report ID {$_GET['ID']}");
$db->query("DELETE FROM preports WHERE prID={$_GET['ID']}");
print "Report cleared and deleted!

[url='staff_users.php?action=reportsview']> Back[/url]";
}
$h->endpage();
?>
Link to comment
Share on other sites

  • 3 weeks later...

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.

 Share

×
×
  • Create New...