08.07.2011, 19:08
hello,
My script stops working when I use this function:
split(data, field, '|');
My script stops working when I use this function:
split(data, field, '|');
#define MYSQL_CHECKFORACCOUNT 1
CheckForAccount(playerid) { // --------------------------------------------------------------------------------- // New SQL style account checker! // --------------------------------------------------------------------------------- new query[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(query, sizeof(query), "SELECT * FROM `users` WHERE `username`='%s'", pname); mysql_query_array(query, MYSQL_CHECKFORACCOUNT, {playerid}, server); }
tcrpg3.pwn(317) : error 008: must be a constant expression; assumed zero
mysql_query(const query[], resultid = (-1), spareid = (-1), MySQL:handle = (MySQL:0));
mysql_query(query, MYSQL_CHECKFORACCOUNT, playerid, server);
mysql_query_array(query, MYSQL_CHECKFORACCOUNT, {playerid, 0}, server);
public Dialog_Login(playerid, inputtext[]) { // --------------------------------------------------------------------------------- // New SQL style login! // --------------------------------------------------------------------------------- new query[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(query, sizeof(query), "SELECT * FROM `users` WHERE `username`='%s'", pname); mysql_query_array(query, MYSQL_LOGIN, {playerid, inputtext}, server);
tcrpg3.pwn(745) : error 008: must be a constant expression; assumed zero
new query[100],output[160],id_sql, count=0; format(query, sizeof(query), "SELECT * FROM `dm_vehicle` WHERE `owner` = '%d' AND `otype` = '2'",PlayerUID[playerid]); mysql_query(query); mysql_store_result(); while(mysql_fetch_row(output, "|")) { sscanf(output, "p<|>d",id_sql); sscanf(output, "p<|>ds[20]ddddfffdd",Veh[id_sql][UID],Item[id_sql][Name],Veh[id_sql][iModel],Veh[id_sql][iObject],Veh[id_sql][iOwn],Veh[id_sql][iOwntype],Veh[id_sql][iPo][0],Veh[id_sql][iPo][1],Veh[id_sql][iPo][2],Veh[id_sql][iInt],Veh[id_sql][iVW]); count++; } mysql_free_result(); return count;
native mysql_connect(const host[], const user[], const pass[], const db[], MySQL:handle = (MySQL:0), auto_reconnect = 0);
hey guys,
ive got a problem. i want to check banned users in a mysql table. a timer should update the bantime every minute. code is: new data[256]; mysql_query("SELECT * FROM accounts"); mysql_store_result(); while(mysql_fetch_row(data)) { name[52], time[52]; mysql_fetch_field("name", name); mysql_fetch_field("ban", time); if(strval(time) > 0) { new query[128]; format(query, 128, "UPDATE accounts SET ban = '%d' WHERE name = '%s'", strval(time) - 1, name); mysql_query(query); } } mysql_free_result(); the problem: the code updates the bantime of the first valid player with bantime > 0. But after this, when the next valid player with bantime > 0 is detectet samp prints in server.log: [01:37:41] [MySQL] Error (0): Function: mysql_store_result called when no result stored. Can anyone help? |
$data1 = mysql_query("SELECT * FROM table1"); while ($row1 = mysql_fetch_assoc($data)) { $data2 = mysql_query("SELECT * FROM table2 WHERE column1 = '" . $row1["column1"] . "'"); while ($row2 = mysql_fetch_assoc($data2)) { echo $row2["column2"]; } }