Converted script to MYSQL
#1

Hello, I am working on converting my script to MYSQL. But got some troubles. it refuses to connect to mysql.

This is the error I get in the server.log

Код:
Function: mysql_connect called with incorrect parameter count.
This is the mysql connect codes

pawn Код:
#define mysql_host "localhost"
#define mysql_user "samp01_db"
#define mysql_password "REMOVED"
#define mysql_database "samp01_db"

mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
First time I ever coded in mysql, any help are appreciated!

Thanks
Reply
#2

which MySQL do you use? BlueG's one? or StrickenKid's because every version of MySQl has got a different parameter

StrickenKid's MySQL Parameter
pawn Код:
mysql_connect(const host[], const user[], const pass[], const db[], MySQL:handle = (MySQL:0), auto_reconnect = 0);
BlueG's MySQL Parameter
pawn Код:
mysql_connect( const host[], const user[], const database[], const password[] )
Reply
#3

I used BlueG's
Reply
#4

Hmm... Your Parameter is right, did you try checking your include and plugins? check if you got the correct plugin and include.
Reply
#5

I will re-download it
Reply
#6

Quote:
Originally Posted by RedWolfX
Посмотреть сообщение
I will re-download it
Yes, try that.
Reply
#7

From a research, it's never been posted anything related to BlueG's MySQL plugin; however, it's been posted in the past about StrickenKid's MySQL plugin.

Are you really sure that you have the include and plugin by BlueG's MySQL plugin?
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
From a research, it's never been posted anything related to BlueG's MySQL plugin; however, it's been posted in the past about StrickenKid's MySQL plugin.

Are you really sure that you have the include and plugin by BlueG's MySQL plugin?
Yes I am sure :P Was following this tutorial: https://sampforum.blast.hk/showthread.php?tid=305994

And it didnt work. Still same error
Reply
#9

Try using g_ConnectionHandle as mysql_connect

pawn Код:
#include <a_samp>
#include <a_mysql>

new g_ConnectionHandle;


public OnGameModeInit()
{
    g_ConnectionHandle = mysql_connect("host", "user", "database", "password");// replace host with host IP, user with database username, database with database name, and password with database password
    return 1;
}
Might not conflict with that error, but I think it's because you probably missed those " "
Reply
#10

Quote:
Originally Posted by Bit
Посмотреть сообщение
Try using g_ConnectionHandle as mysql_connect

pawn Код:
#include <a_samp>
#include <a_mysql>

new g_ConnectionHandle;


public OnGameModeInit()
{
    g_ConnectionHandle = mysql_connect("host", "user", "database", "password");// replace host with host IP, user with database username, database with database name, and password with database password
    return 1;
}
Might not conflict with that error, but I think it's because you probably missed those " "
Did that, still same.
Код:
[16:26:47] Function: mysql_connect called with incorrect parameter count.
Although you said it wouldnt fix it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)