MySQL issues
#1

Well when I use this function to show a dialog and then see if the code is right i get the next error


pawn Код:
FUNCTION: OnAccCodesLoad(playerid)
{
        cache_get_value_int(0, code", PlayerInfo[playerid][pCode]);
    SPD(playerid, D_CHECK, DIALOG_STYLE_INPUT, "
Name?", "{FFFFFF}Text", "Yeah", "Aha");
    return true;
}

//and this is how i use it in that dialog

new string[130];

mysql_format(SQL, string, sizeof(string), "
SELECT `code` FROM `users` WHERE `name`='%e' LIMIT 1", playerid);
mysql_tquery(SQL, string, "
OnAccCodesLoad", "i", playerid);
Reply
#2

What is the next error? Please let us know more.

Besides, what mysql version are you running?
Reply
#3

Quote:
Originally Posted by denNorske
Посмотреть сообщение
What is the next error? Please let us know more.

Besides, what mysql version are you running?
Oh.. stupid me I forgot, and the plugin I'm using is: "R41-4"

PHP код:
[ERRORcache_get_value_name_intinvalid row index '0' (number of rows'0'
Reply
#4

Check if there are rows first.
Reply
#5

try from
Код:
cache_get_value_int(0, code", PlayerInfo[playerid][pCode]);
to
Код:
cache_get_value_int(0, "code", PlayerInfo[playerid][pCode]);
Reply
#6

Quote:
Originally Posted by Ivan_Ino
Посмотреть сообщение
try from
Код:
cache_get_value_int(0, code", PlayerInfo[playerid][pCode]);
to
Код:
cache_get_value_int(0, "code", PlayerInfo[playerid][pCode]);
Nah still the same

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Check if there are rows first.
gonna try that
Reply
#7

Add
Код:
printf("%d", mysql_num_rows());
on the line before
Код:
cache_get_value_int(0, "code", PlayerInfo[playerid][pCode]);
and check response looks like you're getting nothing back from a database
Reply
#8

PHP код:
new nume[25];
GetPlayerName(playerid,nume,sizeof(nume));
mysql_format(SQLstringsizeof(string), "SELECT `code` FROM `users` WHERE `name`='%e' LIMIT 1"nume);
mysql_tquery(SQLstring"OnAccCodesLoad""i"playerid); 
try now
Reply
#9

Oh, of course, I see what an issue is, you are doing query wrong!

Код:
mysql_format(SQL, string, sizeof(string), "SELECT `code` FROM `users` WHERE `name`='%e' LIMIT 1", playerid);
Here you trying to fetch code based on user's name, but you're sending player's id instead of player's name

That is why you getting nothing back from db
Reply
#10

Quote:
Originally Posted by Ivan_Ino
Посмотреть сообщение
Add
Код:
printf("%d", mysql_num_rows());
on the line before
Код:
cache_get_value_int(0, "code", PlayerInfo[playerid][pCode]);
and check response looks like you're getting nothing back from a database
Looks like that I added "cache_get_row_count" and !rows ofc it returns nothing...
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)