MySQL 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 errors (
/showthread.php?tid=458066)
MySQL errors -
lewismichaelbbc - 14.08.2013
This is my code
pawn Код:
#include <a_samp>
#include <a_mysql>
#define SQL_HOST "127.0.0.1"
#define SQL_USER "user"
#define SQL_PASS "pass"
#define SQL_DB "database"
#define COLOR_YELLOW 0xFFFF00AA
#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|")
public OnFilterScriptInit()
{
for(new x = 0; x < 3; x++)
{
if(!mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS))
{
printf("MySQL connection attempt %d failed!", x);
SendClientMessageToAll(COLOR_YELLOW, "MYSQL FAILED");
}
else break;
}
mysql_debug(1);
SendClientMessageToAll(COLOR_YELLOW, "MYSQL CONNECTED");
return 1;
}
public OnFilterScriptExit()
{
SendClientMessageToAll(COLOR_YELLOW, "MYSQL SCRIPT UNLOADED - MYSQL DISCONNECTED");
mysql_close();
return 1;
}
It connects and everything, but as soon as I put this line into the script (under OnFilterscriptInit, it doesnt connect to the mysql server
pawn Код:
format(Query, sizeof(Query), "SELECT * FROM `factions` WHERE `group` = 'Police_Force'");
mysql_query(Query);
I cant actually see any errors so I do not know why it isnt connecting?
Re: MySQL errors -
gtakillerIV - 14.08.2013
Checked the MySQL log ?