logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
What's wrong with this code?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
flel



Joined: 17 Nov 2005
Posts: 5

PostPosted: Sat Nov 19, 2005 13:51    Post subject: What's wrong with this code? Reply with quote

Code:
#include "aps_include"

int IsFactioned(object oPC)
{
    SQLExecDirect("SELECT id FROM id_faction_member WHERE account='" + GetPCPlayerName(oPC) + "'");
    if (SQLFetch())
        return TRUE;
    return FALSE;
}


Data in id_faction_member:
Code:
id=1
account="flel"
Some other irrelevant fields...


Log file output:

Code:
NWNX ODBC2 plugin V.0.9.2.4
(c) 2005 by Ingmar Stieger (Papillon) and Jeroen Broekhuizen
visit us at http://www.nwnx.org

o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using MySQL connection.
o Hooking SCO....hooked at 5c65d0
o Hooking RCO....hooked at 5c64b0
o Connect successful.
o Got request: SELECT id FROM id_faction_member WHERE account='flel'


Function returns false :/
While when I execute this query using EMS SQL Manager it returns a single row(single column too :O) of data...
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sun Nov 20, 2005 1:26    Post subject: Reply with quote

Try this way Smile

Code:


int IsFactioned(object oPC)
{
    string sSQL="SELECT id FROM id_faction_member WHERE account='" + GetPCPlayerName(oPC) + "'";
    SQLExecDirect(sSQL);
    if (SQLFetch())
        return TRUE;
    return FALSE;
}


The SQLExecDirect doesn't like quotes passed to it.....
Back to top
View user's profile Send private message
flel



Joined: 17 Nov 2005
Posts: 5

PostPosted: Sun Nov 20, 2005 18:50    Post subject: Reply with quote

Lol fixed the problem... Pretty silly I didn't read the FAQ and forget SQLInit() Very Happy
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sun Nov 20, 2005 21:36    Post subject: Reply with quote

flel wrote:
Lol fixed the problem... Pretty silly I didn't read the FAQ and forget SQLInit() Very Happy


Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group