it says there is 0 raw but there is 1 raw
#2

The query has to be like this:
Код:
SELECT * FROM users WHERE username = '%s'
You forgot "FROM".

Also you should use threaded queries, but if you still want to use non-threaded queries then you will need to delete the cache after you finish doing the stuff with it. Another thing: you should always escape the strings if you set something. Also you don't need 200 cells for that query, 70 would be enough for the both queries and also you can do sizeof(...) when you format something. I suggest you using mysql_format for formatting queries though because you can escape strings easily by using %e.

Код:
new query[70], row_count, Cache:cache;

mysql_format(g_Sql, query, sizeof(query), "SELECT * FROM users WHERE username = '%s'", PlayerName(playerid));
cache = mysql_query(g_Sql, query);
cache_get_row_count(row_count);

if (row_count)
{
    SendClientMessage(playerid, COLOR_PURPLE, "[MYSQL] Your account found in the mysql");
}
else
{
    mysql_format(g_Sql, query, sizeof(query), "INSERT INTO users (username) VALUES ('%e')", PlayerName(playerid));
    mysql_tquery(g_Sql, string);
    SendClientMessage(playerid, COLOR_PURPLE, "[MYSQL] Your account added to the mysql");
}
cache_delete(cache);
I used a threaded query in the insert query because you don't need a callback for it at this case so it's easy to use.
Reply


Messages In This Thread
it says there is 0 raw but there is 1 raw - by fastayko - 07.01.2017, 22:06
Re: it says there is 0 raw but there is 1 raw - by GoldenLion - 07.01.2017, 22:23
Re: it says there is 0 raw but there is 1 raw - by Jefff - 07.01.2017, 22:24

Forum Jump:


Users browsing this thread: 1 Guest(s)