Posts: 44
Threads: 18
Joined: Jun 2009
Reputation:
0
I'm trying to compile my GM, but left with the same error.
" error 027: invalid character constant "
Here are my lines in question:
sql[0] = mysql_connect(DB_IP, DB_USER, DB_NAME, DB_PASS);
sql[2] = mysql_connect("hidden", "hidden", "hidden", "hidden");
if (connection == sql[0]) sql[0] = mysql_connect(DB_IP, DB_USER, DB_NAME, DB_PASS);
I don't know much about mysql, and it's been awhile since I've opened the server. I'm assuming since then the "mysql_connect" command has since changed, and I don't know what it is now, or how to fix it. Please help.
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
What is
if (connection == sql[0])
for?
Which line is the error on? There may be an error in one of the defines for DB_IP etc.
The only way to solve that is to either show it, or fix it yourself.
Posts: 44
Threads: 18
Joined: Jun 2009
Reputation:
0
The entire function for your question is here.
function reconnect_mysql(connection)
{
if (connection == sql[0]) sql[0] = mysql_connect(DB_IP, DB_USER, DB_NAME, DB_PASS);
else if (connection == sql[2]) sql[2] = mysql_connect("hidden", "hidden", "hidden", "hidden");
else mysql_reconnect(connection);
}
public OnGameModeInit()
{
print("Connecting to database...");
sql[0] = mysql_connect(DB_IP, DB_USER, DB_NAME, DB_PASS);
sql[2] = mysql_connect("hidden", "hidden", "hidden", "hidden"); // (This is for the forum, but I wanted it off)
if (!mysql_ping(sql[0]) || mysql_ping(sql[0]) == -1)
{
print("MYSQL ERROR: Connection failed. [ Host: "DB_IP" - User: "DB_USER" - Pw: "DB_PASS" - Db: "DB_NAME" ]");
SendRconCommand("gmx");
return 0;
}
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
Which line is the error on?
Posts: 44
Threads: 18
Joined: Jun 2009
Reputation:
0
On the functions it's:
if (connection == sql[0]) sql[0] = mysql_connect(DB_IP, DB_USER, DB_NAME, DB_PASS);
and in my Gm it's both:
sql[0] = mysql_connect(DB_IP, DB_USER, DB_NAME, DB_PASS);
and
print("MYSQL ERROR: Connection failed. [ Host: "DB_IP" - User: "DB_USER" - Pw: "DB_PASS" - Db: "DB_NAME" ]");
All of which give me two errors on each line for a total of 6 errors.
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
As I said before, you have an invalid character if the defines. Can you show them? Probably not. What else can you do? As said, you need to either post them here, PM them to me or fix it yourself.
Posts: 44
Threads: 18
Joined: Jun 2009
Reputation:
0
I got it. I feel a little too stupid now. The password provided to me by my hosting WAS using crazy characters and I feel even more silly showing you the reason.
If it's an consolation for wasting your time, you've helped me out a lot.