Get value from MySQL Database
#1

Hi
I have troubles with the new MySQL version.
I can't get string value:

Here is the query:
Код:
mysql_format(ServerDB, query, sizeof(query), "SELECT `Lozinka` FROM `igraci` WHERE `KorisnickoIme` = '%e'", ime[playerid]);
mysql_tquery(ServerDB, query, "ProveriAkaunt", "i", playerid);
Here is the callback:
Код:
public ProveriAkaunt(playerid) {
        cache_get_value_name(0, iData[playerid][Lozinka], "Lozinka", 30);
        printf("LOZ: %s", iData[playerid][Lozinka]);
	return 1;
}
It prints just LOZ: which means the variable is null.
Reply
#2

Ok so, you have problem with query and public too, so first when you are getting name from database it should be %s (String) not %e. That what I notice so far.
Reply
#3

Quote:

%e specifier escapes a string so we can avoid sql injection which means we don't have to use mysql_real_escape_string

BTW i get this error
Код:
[21:10:25] [ERROR] cache_get_value_name: empty field name
Reply
#4

Код:
Parameters:
    (row_idx, const column_name[], destination[], max_len = sizeof(destination))
Means you have column name and destination switched. Takes a genius to figure that out.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Код:
Parameters:
    (row_idx, const column_name[], destination[], max_len = sizeof(destination))
Means you have column name and destination switched. Takes a genius to figure that out.
Oh my god, THANKS!

There's no error but i still can't get the value. iData[playerid][Lozinka] is still null.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)