13.12.2014, 21:43
I guess that you made the system in the wrong way. It is pretty weird. You are surely messing IDs.
--
Is there a way for getting a value from database (with mysql_query) when executing a query (mysql_pquery) without automatically removing the first result set (from mysql_pquery)?
--
Is there a way for getting a value from database (with mysql_query) when executing a query (mysql_pquery) without automatically removing the first result set (from mysql_pquery)?
pawn Код:
public OnFilterScriptInit( )
{
mysql_pquery( 1, "SELECT `Key` FROM `Accounts`", "ChangePassword" );
return 1;
}
function ChangePassword( )
{
new liRows = cache_get_row_count( ), liKey;
for( new rowid = 0; rowid < liRows; rowid ++ )
{
liKey = cache_get_row_int( rowid, 0 );
format( gsQuery, 1024, "UPDATE `Accounts` SET `Password` = '%s' WHERE `Key` = %d", SHA512_Account( liKey, gsString, "password" ), liKey );
mysql_pquery( 1, gsQuery );
// because SHA512_Account function has been executed, the result set is now empty and the following rows are returning only 0. I think that this result set is deleted when the one from mysql_query is created and activated.
}
}
stock SHA512_Account( key, salt[ ], password[ ] )
{
format( gs_lsString, 129, "SELECT sha2( '%d%s%s', 512 )", key, salt, mysql_escape_stringEx( password ) );
giCache = mysql_query( 1, gs_lsString );
cache_get_row( 0, 0, gs_lsString, 1 );
cache_delete( giCache );
return gs_lsString;
}