SQL Syntax Error menu

User Tag List

Results 1 to 6 of 6
  1. #1
    DoxramosPS's Avatar Knight
    Reputation
    26
    Join Date
    Aug 2010
    Posts
    214
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Syntax Error

    I have a script to enter into a table based upon variables.
    PHP Code:
     $raf_insert    "INSERT INTO raf_keys (id,key,active) 
                 VALUES('
    $accountinfo', '$rafnumber', '3')";
    mysql_query($raf_insert) or trigger_error(mysql_error()." in ".$raf_insert); 
    This is the error I receive:
    PHP Code:
    You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'key,active) VALUES('5', '8903251', '3')' at line 1 in INSERT INTO raf_keys (id,key,activeVALUES('5''8903251''3'
    The error lets me know that it is picking up the values of the account and the random number, but for some reason it has the error running at id I believe. Does anyone know what I could do to fix this?
    Thanks
    Mangos and Trinity Emulation
    Windows | Linux
    Under Development : morgangreen.org WoW CMS Site

    SQL Syntax Error
  2. #2
    Vengfull's Avatar War is Coming - Warmonger VPS & Hosting Services
    CoreCoins Purchaser
    Reputation
    782
    Join Date
    Jan 2012
    Posts
    664
    Thanks G/R
    166/80
    Trade Feedback
    8 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    seems weird here
    $raf_insert = "INSERT INTO raf_keys (id,key,active)
    VALUES('
    $accountinfo', '$rafnumber', '3')";

    Notice the red " and bracket?

  3. #3
    DoxramosPS's Avatar Knight
    Reputation
    26
    Join Date
    Aug 2010
    Posts
    214
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah; I coulda swore the " was required though; I'll give it a go without it I've just never seen it done without it.
    Mangos and Trinity Emulation
    Windows | Linux
    Under Development : morgangreen.org WoW CMS Site

  4. #4
    DoxramosPS's Avatar Knight
    Reputation
    26
    Join Date
    Aug 2010
    Posts
    214
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No such luck. Couldn't even execute the page after that.
    Mangos and Trinity Emulation
    Windows | Linux
    Under Development : morgangreen.org WoW CMS Site

  5. #5
    DoxramosPS's Avatar Knight
    Reputation
    26
    Join Date
    Aug 2010
    Posts
    214
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it fixed. Just in case anyone else ever has an issue here the issue lied in ID; I tried to run it through HeidiSQL until I found the issue.
    It seems that the correct syntax is actually
    PHP Code:
    INSERT INTO raf_keys (`id`,`key`,`active`) 
    Notice the ` ` to identify the values. I've never seen that before but hopefully it helps someone.
    Mangos and Trinity Emulation
    Windows | Linux
    Under Development : morgangreen.org WoW CMS Site

  6. #6
    Vengfull's Avatar War is Coming - Warmonger VPS & Hosting Services
    CoreCoins Purchaser
    Reputation
    782
    Join Date
    Jan 2012
    Posts
    664
    Thanks G/R
    166/80
    Trade Feedback
    8 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good job glad you got it sorted.

Similar Threads

  1. Error in your SQL syntax
    By berrz in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 12-16-2008, 04:03 PM
  2. Sql syntax error c++ (help)
    By jmulhern345 in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 08-10-2008, 09:22 PM
  3. ascent-logonserver.exe sql query error ... plz help
    By BillyBob31 in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 03-10-2008, 12:05 PM
All times are GMT -5. The time now is 05:34 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search