Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Can't find exactly what you've been wanting? Try searching for what you are looking for in the search box to the right. ----------->


AuthorTopic: SQL syntax Error  (Read 307 times)

spacing

  • Basic Member
  • *
  • Reputation Power: 1
  • spacing has no influence.
  • Offline Offline
  • Posts: 2
    • View Profile
SQL syntax Error
« on: December 07, 2009, 09:25:11 PM »
ok i made a quick Job just to show the error i am receiving :(

here it is.. could anyone tell me my problem.
Quote
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 ' , , , , 7)' at line 1
Query was INSERT INTO jobranks VALUES('', 'jer', 2, 63, , , , , , 7)
Logged

Spudinski

  • Basic Member
  • *
  • Reputation Power: 42
  • Spudinski has no influence.
  • Offline Offline
  • Posts: 52
  • I have cookies!
    • View Profile
    • WWW
    • Email
Re: SQL syntax Error
« Reply #1 on: December 07, 2009, 10:56:52 PM »
Code: [Select]
INSERT INTO jobranks VALUES('', 'jer', 2, 63, , , , , , 7)
You can not have blank values, pretty simple.
It's either your script not validating input, or it's not building up the correct theory.

Paste the script segment where this error occurs please.
Logged
If you see a post that just doesn't just seem right, send me a PM.
Offering services for small-type games and websites, send me a PM if you want/need something done.

Maketextgames.com

  • Active Member
  • **
  • Reputation Power: 115
  • Maketextgames.com is working their way up.Maketextgames.com is working their way up.Maketextgames.com is working their way up.
  • Offline Offline
  • Posts: 209
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: SQL syntax Error
« Reply #2 on: December 08, 2009, 10:57:01 AM »
Query was INSERT INTO jobranks VALUES('', 'jer', 2, 63, , , , , , 7)


it's the ,,'s

I beleive

Query was INSERT INTO jobranks VALUES('', 'jer', 2, 63,'','','','','',7)

Might work

Would really need to see about 5-10 lines of the actual code tho :p

Danny696

  • Excellent Member
  • ***
  • Reputation Power: 284
  • Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.
  • Offline Offline
  • Posts: 473
    • View Profile
Re: SQL syntax Error
« Reply #3 on: December 08, 2009, 12:15:13 PM »
lol, that wont work, when making a jobrank, make sure every box is filled out. even if its a 0
Logged
My Game: GraveYard; Madness || Projects; N/A -  Available for work. Please IM/PM me.

Maketextgames.com

  • Active Member
  • **
  • Reputation Power: 115
  • Maketextgames.com is working their way up.Maketextgames.com is working their way up.Maketextgames.com is working their way up.
  • Offline Offline
  • Posts: 209
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: SQL syntax Error
« Reply #4 on: December 08, 2009, 04:10:30 PM »
Like I said Danny it depends on what it's calling to

'' will work if it's inserting it manually like a user id is called ''

as the database inserts it for you.

Again, would be a lot more helpful if i saw the query tho >,<

Danny696

  • Excellent Member
  • ***
  • Reputation Power: 284
  • Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.
  • Offline Offline
  • Posts: 473
    • View Profile
Re: SQL syntax Error
« Reply #5 on: December 09, 2009, 10:18:00 AM »
replace the query with this:
Code: [Select]
<?php //do not add to your code.
$query sprintf("INSERT INTO jobranks VALUES('', '%s', %u, %u, %u, %u, %u, %u, %u, $u)"$_POST['jrNAME'], $i$_POST['jrPAY'], $_POST['jrLABOURG'], $_POST['jrSTRG'], $_POST['jrIQG'$_POST['jrLABOURN'], $_POST['jrSTRN'], $_POST['jrIQN']);
if(
$query === FALSE)
{
echo 
mysql_error();
}
else
{
$db->query($query);
}
Logged
My Game: GraveYard; Madness || Projects; N/A -  Available for work. Please IM/PM me.

spacing

  • Basic Member
  • *
  • Reputation Power: 1
  • spacing has no influence.
  • Offline Offline
  • Posts: 2
    • View Profile
Re: SQL syntax Error
« Reply #6 on: December 09, 2009, 04:20:32 PM »
thanks for all the help guys :D
you were right, i just needed to make sure each box had a number or letter in it :)
cheers!

*thumbs up to all*
Logged