Sql syntax error c++ (help) menu

User Tag List

Results 1 to 5 of 5
  1. #1
    jmulhern345's Avatar Banned
    Reputation
    93
    Join Date
    Mar 2008
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sql syntax error c++ (help)

    SO i am getting a syntax error around the name my Arcemu-world says.

    This is the SQL
    ____________________________________________________________
    CREATE TABLE `Puchase_Items` (
    `ID` int(10) NOT NULL auto_increment,
    `Name` varchar(100) NOT NULL,
    `entryID` int(10) NOT NULL,
    PRIMARY KEY (`ID`),
    UNIQUE KEY `ID` (`ID`),
    KEY `Name` (`Name`)
    ) ENGINE=MyISAM AUTO_INCREMENT=18272 DEFAULT CHARSET=latin1;


    ____________________________________________________________
    This is the C++
    ____________________________________________________________
    case BUYITEM_MENU:
    {
    char pItem5[100];
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    sprintf(pItem5, "Enter Item Name [%u]", MORPH_COST/DIVIDER);
    Menu->AddItem(ICON_WHEEL, pItem5, BUYITEM_FUNCTION, 1);
    Menu->SendTo(Plr);
    }break;

    case BUYITEM_FUNCTION:
    {
    QueryResult *pItem5 = WorldDatabase.Query("Select `entryID` FROM Purchase_Items where `Name` = '%s'", Code);

    if(pItem5)
    {
    Field *Fields = pItem5->Fetch();
    uint32 entryID = Fields[0].GetUInt32();
    Plr->SetUInt32Value(INVENTORY_SLOT_NOT_SET, entryID);
    Plr->GetItemInterface()->SafeAddItem(entryID, INVENTORY_SLOT_NOT_SET, 23);
    Plr->Gossip_Complete();
    }
    }break;
    ________________________________________________________________


    See any problems?

    Srry im not sure how to make text boxes lol.
    Last edited by jmulhern345; 08-09-2008 at 07:56 AM.

    Sql syntax error c++ (help)
  2. #2
    Reflection's Avatar Legendary
    Reputation
    783
    Join Date
    Mar 2008
    Posts
    3,377
    Thanks G/R
    1/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Write the text in [code]Text goes here[/ code] without the space.

    About the error, the SQL is fine to me. I even tried to run the query, and it worked perfectly.

    However, I'm unable to help with the c++ error (although the SQL syntax error got something to do with the sql)

    Freelance Digital Artist
    https://reflectionartwork.deviantart.com
    You did not desert me
    My brothers in arms


  3. #3
    Function's Avatar Banned
    Reputation
    5
    Join Date
    May 2008
    Posts
    62
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cant help you with SQL as when I did my EMU I didnt do the sql. I am more of Game programmer, i have other people do the SQL database, But if you want through me the source and I will check out the Syntax error

  4. #4
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CREATE TABLE `Puchase_Items` (
    `ID` int(10) NOT NULL auto_increment,
    `Name` varchar(100) NOT NULL,
    `entryID` int(10) NOT NULL,
    PRIMARY KEY (`ID`),
    UNIQUE KEY `ID` (`ID`),
    KEY `Name` (`Name`)
    ) ENGINE=MyISAM AUTO_INCREMENT=18272 DEFAULT CHARSET=latin1;


    QueryResult *pItem5 = WorldDatabase.Query("Select `entryID` FROM Purchase_Items where `Name` = '%s'", Code);

    Puchase vs Purchase

  5. #5
    jmulhern345's Avatar Banned
    Reputation
    93
    Join Date
    Mar 2008
    Posts
    165
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol thx thespidey but i already figured it out i make stupid lil mistakes. My only problem is that....... i get a duplicate item error when i use the function. Got a clue and i can only spawn it into my first bag not my second or any others.

Similar Threads

  1. SQL Syntax Error
    By DoxramosPS in forum Programming
    Replies: 5
    Last Post: 02-26-2013, 11:18 PM
  2. [ArcEmu] [ArcEmu] Sql Start Error "Please help"
    By acebelowzero22 in forum WoW EMU Questions & Requests
    Replies: 18
    Last Post: 06-15-2010, 07:42 PM
  3. Error in your SQL syntax
    By berrz in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 12-16-2008, 04:03 PM
  4. 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
  5. Race-Race change error plz help
    By Lexan in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 02-27-2007, 10:30 AM
All times are GMT -5. The time now is 05:36 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search