View previous topic :: View next topic |
Author |
Message |
flel
Joined: 17 Nov 2005 Posts: 5
|
Posted: Sat Nov 19, 2005 13:51 Post subject: What's wrong with this code? |
|
|
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 |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Sun Nov 20, 2005 1:26 Post subject: |
|
|
Try this way
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 |
|
|
flel
Joined: 17 Nov 2005 Posts: 5
|
Posted: Sun Nov 20, 2005 18:50 Post subject: |
|
|
Lol fixed the problem... Pretty silly I didn't read the FAQ and forget SQLInit() |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Sun Nov 20, 2005 21:36 Post subject: |
|
|
flel wrote: | Lol fixed the problem... Pretty silly I didn't read the FAQ and forget SQLInit() |
|
|
Back to top |
|
|
|