Field value from mysql
#1

Hello

I have this code:

Код:
static sql1[90];
format(sql1, sizeof(sql1), "SELECT * FROM `users` WHERE `Name` = '%s'", inputtext);
mysql_query(sql1);
mysql_store_result();
Now how can i know the same players SQLID row from users table where Name is inputtext. I have also this:

Код:
mysql_fetch_field_row(sql1, "SQLID");
SendFormatMessage(playerid, -1, "His name is: %s | His SQLID is %d", inputtext, strval(sql1));
But it don`t works, SQLID is always 0 even if player`s SQLID is really 3 or something.
Reply
#2

PHP код:
static sql1[90];
format(sql1sizeof(sql1), "SELECT * FROM `users` WHERE `Name` = '%s'"inputtext);
mysql_query(sql1);
mysql_store_result();
if(
mysql_retrieve_row())
{
    new 
result[50];
    
mysql_fetch_field_row(result,"SQLID");
    
SendFormatMessage(playerid, -1"His name is: %s | His SQLID is %d"inputtextstrval(result));

Should work; sql1 was the actual query, not the rows stored. Although, if you are only getting the SQLID from that query, you should use mysql_fetch_int()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)