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

Solved How to fetch results from database prepared statements?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-23-2021 , 17:25   How to fetch results from database prepared statements?
Reply With Quote #1

Hi,

it is example from docs:

PHP Code:
DBStatement hUserStmt null;
int GetSomeInfo(Database db, const char[] name)
{
    
/* Check if we haven't already created the statement */
    
if (hUserStmt == null)
    {
        
char error[255];
        
hUserStmt SQL_PrepareQuery(db"SELECT userid FROM vb_user WHERE username = ?"errorsizeof(error));
        if (
hUserStmt == null)
        {
            return 
0;
        }
    }
 
    
SQL_BindParamString(hUserStmt0namefalse);
    if (!
SQL_Execute(hUserStmt))
    {
        return 
0;
    }
 
    
/* Get some info here */
    /* return info; */

However, it missing part "Get some info".
What function should I use here and on which handle to retrieve the results?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 06-23-2021 at 17:31.
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 06-23-2021 , 17:31   Re: How to fetch results from database prepared statements?
Reply With Quote #2

Well, solved:

PHP Code:
if( SQL_FetchRow(hUserStmt) )
    {
        
SQL_FetchInt(hUserStmt0userid);
    } 
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 06-23-2021 at 17:33.
Dragokas 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 02:56.


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