Jump to content
MakeWebGames

Recommended Posts

Posted

i came across this mod,.

http://makewebgames.io/showthread.php/25591-mccode-v2-Editing-Organised-Crimes

so when doing this mod i realized my CREATE OC had no existence in the file,. so ive had to make one from scratch,. but have come across an error,.

 

::::HERES THE SCRIPT::::

 

case 'createoc': create_oc(); break;
case 'createocsub': create_oc_submit(); break;

 

function create_oc()
{
global $db,$ir, $c;
if($ir['user_level'] != 2)
{
die("403");
}
print "Create an OC.<br />
<form action='staff_gangs.php?action=createocsub' method='post'>
Name the OC: <input type='text' name='ocNAME' /><br>

Minimum users for crime: <input type='text' name='ocUSERS' /><br>

Beginning Text: <input type='text' name='ocSTARTTEXT' /><br>

Success Text: <input type='text' name='ocSUCCTEXT' /><br>

Failure Text <input type='text' name='ocFAILTEXT' /><br>

Minimum Possible Money <input type='text' name='ocMINMONEY' /><br>

Maximum Possible Money <input type='text' name='ocMAXMONEY' /><br>
<br />
<input type='submit' value='Create OC' /></form>";
}
function create_oc_submit()
{
global $db,$ir,$c,$userid;
if($ir['user_level'] != 2)
{
die("403");
}

$ocNAME=abs((int) $_POST['ocNAME']);
$ocUSERS=abs((int) $_POST['ocUSERS']);
$ocSTARTTEXT=abs((int) $_POST['ocSTARTTEXT']);
$ocSUCCTEXT=abs((int) $_POST['ocSUCCTEXT']);
$ocFAILTEXT=abs((int) $_POST['ocFAILTEXT']);
$ocMINMONEY=abs((int) $_POST['ocMINMONEY']);
$ocMAXMONEY=abs((int) $_POST['ocMAXMONEY']);


$db->query("INSERT INTO orgcrimes (ocNAME, ocUSERS, ocSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY, 
ocMAXMONEY, WHERE ocID='{$_POST['ocID']}' )");
print "Organized Crime created!";
stafflog_add("Created OC");
}

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

::::HERE'S THE ERROR::::

QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ocID='')' at line 2

Query was INSERT INTO orgcrimes (ocNAME, ocUSERS, ocSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY, ocMAXMONEY, WHERE ocID='')

 

::::LINE IT REFERS TO::::

 

$db->query("INSERT INTO orgcrimes (ocNAME, ocUSERS, ocSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY, 
ocMAXMONEY, WHERE ocID='{$_POST['ocID']}')");

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

WHERE ocID='{$_POST['ocID']}'

 

how can this be wrote correctly ?? and isit even correct ??

could anyone give us a hand ??

Posted (edited)
$db->query("INSERT INTO orgcrimes (ocNAME, ocUSERS, onSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY,ocMAXMONEY) VALUES ('{$_POST['ocNAME']}', '{$_POST['ocUSERS']}' , '{$_POST['ocSTARTTEXT']}', '{$_POST['ocSUCCTEXT']}', '{$_POST['ocFAILTEXT']}','{$_POST['ocMINMONEY']},'{$_POST['ocMAXMONEY']}')");
Edited by Jigsaw
Posted

To make you understand a bit more why the query failed, the MySQL "Insert" syntax does not support the "where" clause, so that query failed as it had a "where" clause in it.

Posted (edited)

oh okay thanks Script47,.

and jigsaw i added that in place of the last query but ended up getting this error

 

QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '30000')' at line 1

Query was INSERT INTO orgcrimes (ocNAME, ocUSERS, onSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY,ocMAXMONEY) VALUES ('Armed Robbery', '2' , 'B', 'S', 'F','10000,'30000')

 

personally i cant even see the problem in the script now,.

Edited by jedigunz
opinion
Posted

i spotted a ' missing from it,..

still got this back though

QUERY ERROR: Unknown column 'onSTARTTEXT' in 'field list'

Query was INSERT INTO orgcrimes (ocNAME, ocUSERS, onSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY, ocMAXMONEY) VALUES ('Armed Robbery', '2' , 'B', 'S', 'F', '10000', '30000')

gonna have to refer to the database

Posted

oops,. flew by it,.. onSTARTTEXT ,. meant to be ocSTARTTEXT ,.. thanks for your help Jigsaw & Script47,.

Edited Query and Working ::

 

$db->query("INSERT INTO orgcrimes (ocNAME, ocUSERS, ocSTARTTEXT, ocSUCCTEXT, ocFAILTEXT, ocMINMONEY, ocMAXMONEY) 
VALUES ('{$_POST['ocNAME']}', '{$_POST['ocUSERS']}', '{$_POST['ocSTARTTEXT']}', '{$_POST['ocSUCCTEXT']}', '{$_POST['ocFAILTEXT']}', '{$_POST['ocMINMONEY']}', '{$_POST['ocMAXMONEY']}')");
Posted (edited)
oh okay thanks Script47,.

 

thanks for your help Script47,.

No problem. Glad I could help. :)

Side note: My 200th post, Yay me! :p

Edited by Script47

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