Raised This Month: $32 Target: $400
 8% 

sqlx data to id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fricx
Junior Member
Join Date: Oct 2011
Old 02-11-2012 , 18:33   sqlx data to id
Reply With Quote #1

Hello,

As topic says, sqlx module is returning data and assigning it to a variables. It works fine like this:

PHP Code:

SQL_ReadResult
(Query8data31
but how can I assign it to data[id] and make it unique for that player so it doesn't get overwritten on next query with other players db info.

I tried with:

PHP Code:

SQL_ReadResult
(Query8data[id], 31
but I am getting [AMXX] Run time error 4: index out of bounds.

Last edited by fricx; 02-11-2012 at 19:41.
fricx is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-11-2012 , 18:48   Re: sqlx data too id
Reply With Quote #2

new g_variable[33][33]

SQL_ReadResult( Query , 8 , g_variable[id] , charsmax(g_variable[]) )
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
fricx
Junior Member
Join Date: Oct 2011
Old 02-11-2012 , 19:31   Re: sqlx data too id
Reply With Quote #3

Quote:
Originally Posted by lucas_7_94 View Post
new g_variable[33][33]

SQL_ReadResult( Query , 8 , g_variable[id] , charsmax(g_variable[]) )
So I have:

PHP Code:
global... overall_time[33][33]
...
SQL_ReadResult(Query14overall_time[id], charsmax(overall_time[])) 
and when I do

PHP Code:

ShowSyncHudMsg
(0g_SyncObj[1], "Overall time: %s"overall_time[id]) 
I still get [AMXX] Run time error 4: index out of bounds
fricx is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-11-2012 , 20:06   Re: sqlx data to id
Reply With Quote #4

show complete load funcion please.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-11-2012 , 23:47   Re: sqlx data to id
Reply With Quote #5

Explain exactly what you are retrieving from the database (what it's called, data type, etc.) and exactly how you want it stored into a variable.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fricx
Junior Member
Join Date: Oct 2011
Old 02-12-2012 , 07:25   Re: sqlx data to id
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
Explain exactly what you are retrieving from the database (what it's called, data type, etc.) and exactly how you want it stored into a variable.
Hello,

I am doing a left inner join query, which executes successfully and gives me database fields that I am requesting. The query itself is working, and I am getting the data from database. For example this works:

PHP Code:

SQL_ReadResult
(Query14overall_time31
but what I want to do is to assign overall_time to this specific player, like overall_time[id], so I can use it to display this information via HUD(id) function only to that player. Like this:

PHP Code:

public Hud(id)
 {
      if(
is_member[id])
       {
        
set_hudmessage(000, -0.850.010UPDATETIME+0.10.51.01.0, -1)
        
ShowSyncHudMsg(0g_SyncObj[0], "Overall time: %s"overall_time[id])
      }

Without [id], overall_time variable gets replaced by other player sql data when he connects to the server, and so on...

The query is called on register_client function.

Just to add that fields types in db are, int, varchar and float, maybe I am missing something.

The error I keep getting in server log is: [AMXX] Run time error 4: index out of bounds

Thank you for your reply.
fricx is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-12-2012 , 10:57   Re: sqlx data to id
Reply With Quote #7

Code:
new g_playername[33][33] SQL_ReadResult( Query , numofcolumn , g_playername[ id ] , charsmax( g_playername[] ) ) client_print( index , print_chat, "The name in db is %s" , g_playername [ index ] )

For me always works , i repeat , if you can post code, will be great.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 02-12-2012 at 10:58.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
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 22:34.


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