format(query, sizeof(query), "SELECT `id_member` FROM `members` WHERE `member_name` = '%s'",playerName);
mysql_query(query, MYSQL_RESULT_REGISTER, playerid, connection);
mysql_store_result(connection);
mysql_fetch_field("id_member",result,connection);
[02:42:01] [MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed. [02:42:01] [MySQL] Error (0): Function: mysql_fetch_field called when no result stored. [02:42:01] [MySQL] Error (0): Could not execute query. Unknown column 'aqweqaaw' in 'where clause'. |
new VariableToStoreMemberID;
format(query, sizeof(query), "SELECT * FROM members WHERE member_name = '%s'", playerName);
mysql_query(query); // Execute the formatted query
mysql_store_result(); // Store the results of the query
while(mysql_fetch_row(query, "|"))
{
mysql_fetch_field("member_id", query); VariableToStoreMemberID = strval(query); // Get the value from member_id field and turn it into a int instead of a string. (that is if you're saving it as a VARCHAR or alike)
}
Try something like:
pawn Код:
|
format(query, sizeof(query), "INSERT INTO smf_members (member_name, passwd, real_name, date_registered) VALUES ('%s', SHA1('%s'), '%s', '%i')",playerName, escapedPass, playerName, Seconds);
mysql_query(query, MYSQL_MEMBER_ID, playerid, connection);
case MYSQL_MEMBER_ID:
{
new myName[24];
GetPlayerName(spareid, myName, sizeof(myName));
format(playerData[spareid][playerNamee], 24, "%s", myName);
new VariableToStoreMemberID, query[300];
format(query, sizeof(query), "SELECT `id_member` FROM `smf_members` WHERE member_name = '%s' LIMIT 1", playerData[spareid][playerNamee]);
mysql_query(query); // Execute the formatted query
mysql_store_result(); // Store the results of the query
while(mysql_fetch_row(query, "|"))
{
mysql_fetch_field("id_member", query);
VariableToStoreMemberID = strval(query); // Get the value from member_id field and turn it into a int instead of a string. (that is if you're saving it as a VARCHAR or alike)
format(query, sizeof(query), "INSERT INTO smf_log_online (session, log_time, id_member, id_spider, ip, url) VALUES (0, 0, '%d', 0, 0, 0)",VariableToStoreMemberID);
mysql_query(query);
}
mysql_free_result();
}
[12:24:54] [MySQL] Error (0): Function: mysql_store_result called when no result stored. |
mysql_store_result(); // Store the results of the query
while(mysql_fetch_row(query, "|"))
{
mysql_fetch_field("id_member", query);
VariableToStoreMemberID = strval(query); // Get the value from member_id field and turn it into a int instead of a string. (that is if you're saving it as a VARCHAR or alike)
format(query, sizeof(query), "INSERT INTO smf_log_online (session, log_time, id_member, id_spider, ip, url) VALUES (0, 0, '%d', 0, 0, 0)",VariableToStoreMemberID);
mysql_query(query);
}
mysql_free_result();