Mysql load things in wrong direction ??
#1

Hello, I'm working on a register system with mysql.
I think i understand how it works and all that but the problem is that when I want to check the number of rows that i have selected it haven't loaded them yet even since I've scripted that it should SELECT them first then select num rows


Here is how it looks like:

This is OnPlayerRequestSpawn (have tryed with OnPlayerConnect to)
Код:
//-------------------------------------MySQL/regiser system---------------------------------------
    playerinfo[playerid][money] = -1;
    new query[200], pname[24]; //Creates our variables.
    GetPlayerName(playerid, pname, 24); //Gets the players name
    format(query, sizeof(query), "SELECT * FROM `playerinfo` WHERE name = '%s' LIMIT 1", pname); //Formats the query, view above the code for a explanation
    mysql_function_query(dbHandle, query, false, "", "");
    mysql_store_result(); //We store the result.
    new rows = mysql_num_rows(); //We get how many rows the query returned
    if(!rows){
        ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_PASSWORD, "Register","Your user is {FF0000}not{FFFFFF} registered! Please register with a password below!","Register","Cancel");
    }
	else if(rows > 1){
		ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please login with your password below!","Login","Cancel"); //Shows our login dialog :).
	}
	else{
     SendClientMessage(playerid, COLOR_ERROR, "Mysql Is bugged");
	}
    mysql_free_result();
and here is the mysql_log.txt
Код:
[17:08:25]  ** MySQL Debugging enabled (06/22/12)
[17:08:25]  
[17:08:25] >> mysql_connect(localhost, root, sa-mp, ******) on port 3306
[17:08:25] CMySQLHandler::CMySQLHandler() - constructor called.
[17:08:25] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "sa-mp" | Username: "root"
[17:08:25] CMySQLHandler::Connect() - Connection was successful.
[17:08:25] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[17:08:25] >> mysql_ping( Connection handle: 1 )
[17:08:25] CMySQLHandler::Ping() - Connection is still alive.
[17:08:54] >> mysql_query_callback( Connection handle: 1 )
[17:08:54] >> mysql_store_result( Connection handle: 1 )
[17:08:54] CMySQLHandler::StoreResult() - No data to store.
[17:08:54] >> mysql_num_rows( Connection handle: 1 )
[17:08:54] Passing query SELECT * FROM `playerinfo` WHERE name = 'Player' LIMIT 1 | 
[17:08:54] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[17:08:54] >> mysql_free_result( Connection handle: 1 )
[17:08:54] CMySQLHandler::FreeResult() - The result is already empty.
[17:08:54] ProcessQueryThread() - Query was successful. (SELECT * FROM `playerinfo` WHERE name = 'Player' LIMIT 1)
[17:08:54] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
Thanks for all answers and hope I'll get it working
Reply
#2

You need to chagn e the mysql details to your mysql database details?
Reply
#3

Quote:
Originally Posted by sanrock
Посмотреть сообщение
You need to chagn e the mysql details to your mysql database details?
I have already set up the right connection things to the server and it pings the server correctly, so i don't know what's the problem.

When i log on it always says "mysql is bugged" because it can't save anything to the mysql_store_result becuse Select query loads after the mysql_sotre_result but I've scripted it before?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)