Raised This Month: $51 Target: $400
 12% 

SQL_ReadResult()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 03-25-2012 , 16:20   SQL_ReadResult()
Reply With Quote #1

I'm having problems with my new plugin. If I retrieve (query) data from a database and the selected value from a column it's not existing, then I get errors in my server console. I'm looking for a native like SQL_Execute, if the query succes than return 1.
PHP Code:
...
formatex(szQuerycharsmax(szQuery), "SELECT * FROM `%s_player_id` WHERE name='%s'"l_prefixname)

SQL_ThreadQuery(g_SqlTuple"getPlayerID"szQueryparamcharsmax(param) )
...

public 
getPlayerID(...)

if(
something like SQL_Execute(query))
   
//query succes, than read result
else
  
//print msg -> sorry no data found. 
It's it's very annoying if I get errors in my log folder and in my server console if data it's not existing.
killergirl is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-25-2012 , 16:33   Re: SQL_ReadResult()
Reply With Quote #2

Code:
SQL_IsFail( const iFailState, const iError, const szError[ ] ) {     if( iFailState == TQUERY_CONNECT_FAILED )     {         log_to_file( LogFile, "[Error] Could not connect to SQL database: %s", szError );         return true;     }     else if( iFailState == TQUERY_QUERY_FAILED )     {         log_to_file( LogFile, "[Error] Query failed: %s", szError );         return true;     }     else if( iError )     {         log_to_file( LogFile, "[Error] Error on query: %s", szError );         return true;     }         return false; }
Code:
public HandleSomeRandomQuery( iFailState, Handle:hQuery, szError[ ], iError, szData[ ], iSize, Float:flQueueTime ) {     if( SQL_IsFail( iFailState, iError, szError ) )     {         return;     }         // Read results }
__________________

Last edited by xPaw; 03-25-2012 at 16:33.
xPaw is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-25-2012 , 16:43   Re: SQL_ReadResult()
Reply With Quote #3

PHP Code:
if(SQL_MoreResults(query))
   
//query succes, than read result
else
  
//print msg -> sorry no data found. 
This has nothing to do with query success. Query is successful even if no data was found.
__________________
Impossible is Nothing

Last edited by Sylwester; 03-25-2012 at 16:46.
Sylwester is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode