Problem MYSQL.
#1

Hi what that errors means?

PHP код:
[12:52:40] [ERROR"mysql_format" invalid connection handle (ID 1)
[
12:52:40] [ERROR"mysql_tquery" invalid connection handle (ID 1
PHP код:
                    mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET `Money`='%d' WHERE `name`='%s'",GetPlayerCash(playerid), playerName);
                    
mysql_tquery(SQL, var, """"); 
I use MYSQL r39-4.
Reply
#2

Did you use "mysql_connect" before using any mysql functions?

Just using
PHP код:
#define SQL 1 
This wouldn't work, you need an active connection first.

PHP код:
// Define your MySQL connection info here
#define MYSQL_HOST                        "127.0.0.1"
#define MYSQL_USER                        "UserName"
#define MYSQL_PASSWORD                    "Password"
#define MYSQL_DATABASE                    "Database"
new SQL// Will hold the connectionhandle to the database
public OnGameModeInit()
{
    
// Connect to the MySQL database and store the connection-handle
    
SQL mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_DATABASEMYSQL_PASSWORD);
    return 
1;

Like this.
Reply
#3

I had this SQL definition:
PHP код:
new SQL = -1
Yes i use mysql_connect, #define MYSQL_HOST and others, but i need to use #define SQL 1?
Reply
#4

No, I'm just saying that defining the connectionhandle manually is not the proper way.
You would be giving your mysql function a fake connection id, while it hasn't been created and therefore, cannot be executed.

It should be done as shown in my last example.

Are you sure your connection is active?
Trying to connect and having a fail would also explain the errors you get.
Reply
#5

Solved, i replaced new SQL -1 with new SQL
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)