[Mysql] Get the fields of a query and put them on a variable
#1

I have a query like this:
Код:
SELECT name, surname  FROM `pgs`,`users` WHERE `username`='%s'
With this query I get all the pgs associated to the user account on the table users. I want to put the name and the surname on a variable (or two variables, I don't know how to do that).
When I have just one field to select I usually do:

pawn Код:
new query[90];
new result[10];
new ris;
format(query,sizeof(query),"SELECT `admin` FROM `users` WHERE `username` = '%s'", GetName(playerid));
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1)
{
    mysql_fetch_row_format(result);
    ris = strval(result);
}
mysql_free_result();
If I have multiple fields or multiple rows how I do that?
Thanks for the help.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)