mysql does not load string (no errors) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread:  mysql does not load string (no errors) (
/showthread.php?tid=637648)
 
mysql does not load string (no errors) - 
Lirbo -  18.07.2017
PHP код:
mysql_format(sql, query, sizeof query, "SELECT `chat_color` FROM `user_features` WHERE `id` = %d", DB[playerid][ID]);
    result = mysql_query(sql, query);
    printf(query);
    new getstr2[15];
    cache_get_field_content(0, "chat_color", getstr2);
    format(DB[playerid][ChatColor], 15, getstr2);
    Message(playerid, TYPE_INFO, getstr2);
    Message(playerid, TYPE_INFO, DB[playerid][ChatColor]);
    cache_delete(result); 
 no errors at all,
Batch file (printf), all seem to be good:
PHP код:
SELECT `chat_color` FROM `user_features` WHERE `id` = 4 
 but getstr2 stays blank for some reason.
Re: mysql does not load string (no errors) - 
HoussemGaming -  18.07.2017
Show us your Mysql log
Re: mysql does not load string (no errors) - 
saffierr -  19.07.2017
Try this:
PHP код:
cache_get_field_content(0, "chat_color", getstr2, sql, 15); 
 
Re: mysql does not load string (no errors) - 
Lirbo -  19.07.2017
Quote:
					Originally Posted by  saffierr
 
 
Try this: 
PHP код: 
cache_get_field_content(0, "chat_color", getstr2, sql, 15); 
 
 
  
 | 
 Gives me errors ^
Quote:
					Originally Posted by  HoussemGaming
 
 
Show us your Mysql log 
 | 
 I have no mysql logs over that, it does not give me any error.
Re: mysql does not load string (no errors) - 
Kaperstone -  19.07.2017
First of all, you're using mysql_query, if you intend to halt the script until the query finishes, then you used the right function, if not, then use tquery or pquery.
Its differences are explained here.
http://forum.sa-mp.com/showpost.php?...postcount=5021
Second, try to launch the query through the cli or a MySQL administration software you have on (most have phpMyAdmin)
If it doesn't return anything, then either your query is not correct or you don't have such a record.