SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/08/2017, 08:54 AM   #11
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,910
Reputation: 2581
Default Re: Mysql Fetching Row

Still don't understand. Please state what you would the output to be like exactly. Type it up in Excel or something and post a screenshot or use the [ttable][/ttable] tags to put a table in your post.

If you want to fetch rows from two different tables in a single result set then you have to use a JOIN. There is also UNION but that won't work here because the number of columns and the datatypes don't match up.
__________________
Vince is offline   Reply With Quote
Old 13/08/2017, 11:11 AM   #12
KizZweLL
Little Clucker
 
KizZweLL's Avatar
 
Join Date: Jan 2016
Location: Philippines
Posts: 24
Reputation: 0
Default Re: Mysql Fetching Row

PHP Code:
stock LoadPosition(playerid

    new 
query[100],aName[MAX_PLAYER_NAME]; 
    
GetPlayerName(playerid,aName,sizeof(aName)); 
    
format(query,sizeof(query),"SELECT * FROM positions WHERE Name = '%s'",aName); 
    while(
mysql_fetch_row_format(query,"][")) 
    { 
        
mysql_fetch_field_row(query,"PositionX");     PlayerPos[playerid][Pos][0] = floatstr(query); 
        
mysql_fetch_field_row(query,"PositionY");     PlayerPos[playerid][Pos][1] = floatstr(query); 
        
mysql_fetch_field_row(query,"PositionZ");     PlayerPos[playerid][Pos][2] = floatstr(query); 
        
mysql_fetch_field_row(query,"Angle");        PlayerPos[playerid][Angle] = floatstr(query); 
    } 
    
SetSpawnInfo(playerid,0,0,PlayerPos[playerid][Pos][0],PlayerPos[playerid][Pos][1],PlayerPos[playerid][Pos][2],PlayerPos[playerid][Angle],0,0,0,0,0,0); 
    
SetCameraBehindPlayer(playerid); 
    
SpawnPlayer(playerid); 
     
    return 
1


stock LoginPlayer(playerid

    new 
query[100],aName[MAX_PLAYER_NAME]; 
    
GetPlayerName(playerid,aName,sizeof(aName)); 
    
format(query,sizeof(query),"SELECT * FROM accounts WHERE Name = '%s'",aName); 
    while(
mysql_fetch_row_format(query,"][")) 
    { 
        
mysql_fetch_field_row(query,"Cash"); PlayerInfo[playerid][Cash] = strval(query); 
        
mysql_fetch_field_row(query,"Kills"); PlayerInfo[playerid][Kills] = strval(query); 
    } 
    
GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]); 
    
PlayerPlaySound(playerid,1057,2,2,3); 
    return 
1

WHEN YOU ADD

LoadPosition(playerid);
LoginPlayer(playerid);

Then look at debug.txt

CMySQLHandler::FetchRow() - Return: Reprobate ][ pass ][ 20000 ][ 0 ][ 24 ][ 1683.11 ][ -2328.21 ][ 13.5469 ][ 3.00244 ][

AND NOT having a Fetch row FROM POSITIONS. only in LoginPlayer. Still don't get it?

IT IS LIKE Making a LoadPosition and Login & Register Filterscript.
__________________
Sometimes impossible can turn into reality.
KizZweLL is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL fetching a boolean value dominik523 Scripting Help 3 25/01/2015 10:05 AM
MySQL not fetching. EliteApple Scripting Help 2 22/09/2013 01:02 AM
[MySQL] Not fetching all groups [TC]XxJuggaloxX Scripting Help 2 25/02/2013 11:52 PM
Fetching vehicle MySQL ID from SAMP ID zDevon Scripting Help 3 07/01/2013 01:01 AM
mySQL fetching PDChaseOfficial Scripting Help 0 04/01/2013 03:53 PM


All times are GMT. The time now is 01:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.