Raised This Month: $138 Target: $400
 34% 

How does SQL_FetchInt work??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 09-06-2019 , 04:47   How does SQL_FetchInt work??
Reply With Quote #1

Got the following table
PHP Code:
"CREATE TABLE IF NOT EXISTS `stats` (`steamid` varchar(32) PRIMARY KEY NOT NULL, `xp` INT( 16 ), `level` INT( 16 ))" 
.. somewhere in the code ..
PHP Code:
..
    
iXP[client] = SQL_FetchInt(hndl0);
    
iLevel[client] = SQL_FetchInt(hndl1);
.. 
xp is returner right, but the level no

what I did wrong?

this is stressing me out
__________________
kratoss1812 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 09-06-2019 , 04:53   Re: How does SQL_FetchInt work??
Reply With Quote #2

Quote:
Originally Posted by kratoss1812 View Post
Got the following table
PHP Code:
"CREATE TABLE IF NOT EXISTS `stats` (`steamid` varchar(32) PRIMARY KEY NOT NULL, `xp` INT( 16 ), `level` INT( 16 ))" 
.. somewhere in the code ..
PHP Code:
..
    
iXP[client] = SQL_FetchInt(hndl0);
    
iLevel[client] = SQL_FetchInt(hndl1);
.. 
xp is returner right, but the level no

what I did wrong?

this is stressing me out
you didn't show your mysql query....
__________________
8guawong is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 09-06-2019 , 05:01   Re: How does SQL_FetchInt work??
Reply With Quote #3

You need to do a select query:

PHP Code:
select xplevel from stats where steamid = %
Then in the thread function you fetch the row and then you fetch the columns:

PHP Code:

if (rs.FetchRow())
{
    
int xp rs.FetchInt(0); // the first column
    
int level rs.FetchInt(1); // the second column

__________________
Ilusion9 is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 09-06-2019 , 05:24   Re: How does SQL_FetchInt work??
Reply With Quote #4

Figured out literally 2 seconds after I posted this. My dumbass was selecting only the xp..

Thanks
__________________
kratoss1812 is offline
Reply


Thread Tools
Display Modes

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:55.


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