You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 27.02.2012
Hi, I am currently Learning MySQL system But I am getting Problem , I am Storing field_row but on debug logs are
"CMySQLHandler::FetchField(userid) - You cannot call this function now. (Reason: Fields/Rows are empty.)" \
....
Here's The Code where this error is...
pawn Код:
case D_LOGIN:
{
if(response)
{
new query[128],query_run,P_Name[24],rows,escpass[24],data[24],tmpid;
GetPlayerName(playerid,P_Name,sizeof(P_Name));
//GetPlayerIp(playerid,P_IP,sizeof(P_IP));
mysql_real_escape_string(inputtext, escpass);
format(query,sizeof(query),"SELECT userid FROM `p_data` WHERE `username` = '%s' AND password = '%s' LIMIT 1",P_Name,escpass);
query_run = mysql_query(query);
mysql_store_result();
rows = mysql_num_rows(query_run);
if(rows == 1)
{
mysql_fetch_field_row(data, "userid"); tmpid = strval(data);
mysql_free_result();
format(query,sizeof(query),"Your Register ID is %d !",tmpid);//checking if working....
SendClientMessage(playerid, C_SKYBLUE, query);
SendClientMessage(playerid, C_SKYBLUE, "You have been logged in!");
IsLogged[playerid] = 1;
}
else if(rows == 0)
{
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_INPUT, "Login","Incorrect Password.\n Please enter your password again.","Login","Cancel");
SendClientMessage(playerid, C_RED, "Incorrect password!");
}
}
if(!response)
{
SendClientMessage(playerid, 0xFF0000, "You must login before you spawn!");
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_INPUT, "Login","Account Registered! Please login with your password below!\n You must login before you spawn!","Login","Cancel");
}
}
Debug Logs:
Код:
[14:05:10] ---------------------------
[14:05:10] MySQL Debugging activated (02/27/12)
[14:05:10] ---------------------------
[14:05:10]
[14:05:10] >> mysql_connect( )
[14:05:10] CMySQLHandler::Connect() - Connection was successful.
[14:05:10] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[14:05:10] >> mysql_query( Connection handle: 1 )
[14:05:10] CMySQLHandler::Query(SELECT * FROM `p_data` WHERE username = 'Shabi' LIMIT 1) - Successfully executed.
[14:05:10] >> mysql_store_result( Connection handle: 1 )
[14:05:10] CMySQLHandler::StoreResult() - Result was stored.
[14:05:10] >> mysql_num_rows( Connection handle: 1 )
[14:05:10] CMySQLHandler::NumRows() - Returned 1 row(s)
[14:05:10] >> mysql_free_result( Connection handle: 1 )
[14:05:10] CMySQLHandler::FreeResult() - Result was successfully free'd.
[14:05:13] >> mysql_real_escape_string( Connection handle: 1 )
[14:05:13] CMySQLHandler::EscapeString(shahab); - Escaped 6 characters to shahab.
[14:05:13] >> mysql_query( Connection handle: 1 )
[14:05:13] CMySQLHandler::Query(SELECT userid FROM `p_data` WHERE `username` = 'Shabi' AND password = 'shahab' LIMIT 1) - Successfully executed.
[14:05:13] >> mysql_store_result( Connection handle: 1 )
[14:05:13] CMySQLHandler::StoreResult() - Result was stored.
[14:05:13] >> mysql_num_rows( Connection handle: 1 )
[14:05:13] CMySQLHandler::NumRows() - Returned 1 row(s)
[14:05:13] >> mysql_fetch_field_row( Connection handle: 1 )
[14:05:13] CMySQLHandler::FetchField(userid) - You cannot call this function now. (Reason: Fields/Rows are empty.)
[14:05:13] >> mysql_free_result( Connection handle: 1 )
[14:05:13] CMySQLHandler::FreeResult() - Result was successfully free'd.
Whats wrong I do??
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 27.02.2012
Any One?
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 27.02.2012
?? Any
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Lorenc_ - 27.02.2012
pawn Код:
format(query,sizeof(query),"SELECT userid FROM `p_data` WHERE `username` = '%s' AND password = '%s' LIMIT 1",P_Name,escpass);
mysql_query(query);
mysql_store_result();
f(mysql_num_rows() == 1)
{
// If the user is registered
}
else
{
// If the user isn't registered.
}
mysql_free_result();
Try that?
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 27.02.2012
offcourse , am using this in player connent and its working....
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 27.02.2012
please any one...
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 28.02.2012
hmm? I have also tried different way of coding but same error.
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 29.02.2012
Any One
? Please REP+
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Lorenc_ - 29.02.2012
try me code, and stop bumping every hour..
Re: You cannot call this function now. (Reason: Fields/Rows are empty.) -
Shabi RoxX - 29.02.2012
Quote:
Originally Posted by Lorenc_
try me code, and stop bumping every hour..
|
I tried , Its Working Now when am Using...
pawn Код:
mysql_fetch_row_format(string[], const delimiter[], connectionHandle)