SA-MP Forums Archive
mysql_query error, HELP PLS - 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_query error, HELP PLS (/showthread.php?tid=547786)



mysql_query error, HELP PLS - kexy96 - 25.11.2014

Код:
public AutoSaveVehicles()
{
    //new Query[400];
    new save[400];
    for(new id; id < MAX_CARS; id++)
    {
		new Float:health;
  		GetVehicleHealth(id, health);
  		Vehicles[id][Damage] = floatround(health);
        format(save, sizeof(save), "UPDATE Vehicles SET Fuel = %d, Damage = %d WHERE SQLID = %d",

									Vehicles[id][Fuel],
									Vehicles[id][Damage],
									id);
		mysql_query(save);
    }
	return 1;
}
Error Code:
Код:
error 035: argument type mismatch (argument 1)
Help me pls, i dont have good idea :/


Re: mysql_query error, HELP PLS - Jonesy96 - 25.11.2014

What line is the error on? Aslo, show me your Vehicled enum


Re : mysql_query error, HELP PLS - LaPiMoNsTeR - 25.11.2014

You need to put the mysql connection.
pawn Код:
new mysql;

public OnGameModeInit()
{
    mysql = mysql_connect(<your_host>, <your_user>, <your_db>, <your_password>);
    return 1;
}

public AutoSaveVehicles()
{
    //new Query[400];
    new save[400];
    for(new id; id < MAX_CARS; id++)
    {
        new Float:health;
        GetVehicleHealth(id, health);
        Vehicles[id][Damage] = floatround(health);
        format(save, sizeof(save), "UPDATE Vehicles SET Fuel = %d, Damage = %d WHERE SQLID = %d",Vehicles[id][Fuel],Vehicles[id][Damage],id);
        mysql_query(mysql, save);
    }
    return 1;
}



Re: mysql_query error, HELP PLS - kexy96 - 25.11.2014

Not only this lines, lot of error
Код:
error 035: argument type mismatch (argument 1)
..

But, I write : #include <mysql> , its the problem is solved , but don't save accounts,vehicles ...


Re: mysql_query error, HELP PLS - kexy96 - 25.11.2014

Код:
 MySQLConnect()
{
	
	mysql_connect("localhost", "testsamp", "testsamp", "asdasd");
    mysql_debug(1);
    if(mysql_ping()) print("MySQL connection is alive!");
    if(!mysql_ping()) print("MySQL connection failed.");
    return 1;
}
Have mysql connect...


Re: mysql_query error, HELP PLS - dusk - 25.11.2014

Your code seems to be written in an older version of MySQL plugin. R6 or older. Find and download R6, both the include and plugin.


Re: mysql_query error, HELP PLS - kexy96 - 25.11.2014

I download R6 plugin version. Don't have error, but don't save accounts WHY?


Re: mysql_query error, HELP PLS - kexy96 - 25.11.2014

Mysql connection failed... why?