[Plugin] [REL] SA:MP MySQL Plugin 2.1.1 - Released (1/25/2011

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
Hi, I have this querry:

pawn Код:
CMDSString = "";
strcat(CMDSString, "INSERT INTO `playerinfo` (`UserID`, `User`, `Password`, `RegisterDate`, `LastVisit`, `Level`, `Banned`, `Score`, `Money`, `WantedLevel`, `DrunkLevel`, `FightStyle`, `Skin`, `Kills`, `Deaths`, ");
strcat(CMDSString, "`RegisteredIP`, `LastIP`, `Donator`, `ReactionTestsWon`, `Settings_SaveSkin`, `PlayingTime`, `MinutesConnected`, `HoursConnected`, `DaysConnected`, `RegularPlayer`, `NoPM`, `Settings_PreferedColour`, `Settings_WatchPMs`, ");
strcat(CMDSString, "`Settings_WatchCMDs`, `Settings_WatchPlayerInfo`, `FavouriteVehicle`, `RejoinDM`, `Settings_GodSkin`, `Settings_JoinMessage`) VALUES ");
format(CMDSString2, sizeof(CMDSString2), "('%d', '%s', '%d', '%s', '%s', '0', '0', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '0', '%d', '%d', '%s', 0, 0, 0, 0, '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", uid, escapestring[0], udb_hash(escapestring[1]), RegDate, RegDate, d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], GetPlayerIpEx(playerid), GetPlayerIpEx(playerid), d[8], d[9], pTime, d[10], d[11], d[12], d[13], d[14], d[15], d[16], d[17], d[18]);
strcat(CMDSString, CMDSString2);
print(CMDSString);
mysql_query(CMDSString);
Full querry:
Код:
[18:57:23] INSERT INTO `playerinfo` (`UserID`, `User`, `Password`, `RegisterDate`, `LastVisit`, `Level`, `Banned`, `Score`, `Money`, `WantedLevel`, `DrunkLevel`, `FightStyle`, `Skin`, `Kills`, `Deaths`, `RegisteredIP`, `LastIP`, `Donator`, `ReactionTestsWon`, `Settings_SaveSkin`, `PlayingTime`, `MinutesConnected`, `HoursConnected`, `DaysConnected`, `RegularPlayer`, `NoPM`, `Settings_PreferedColour`, `Settings_WatchPMs`, `Settings_WatchCMDs`, `Settings_WatchPlayerInfo`, `FavouriteVehicle`, `RejoinDM`, `Settings_GodSkin`, `Settings_JoinMessage`) VALUES ('12', '[03]Garsino', '259982180', '06/10/2010', '06/10/2010', '0', '0', '0', '0', '0', '0', '4', '0', '0', '', '127.0.0.1', '0', '49', '0', '', 0, 0, 0, 0, '48', '0', '0', '0', '0', '0', '-1', '0', '0')
But in my server console I get the following error:
Код:
[18:57:24] [MySQL] Error (0): Failed to exeute query. Column count doesn't match value count at row 1.
Can you see whats wrong with my code? I've been stuck with this problem for days now and I can't seem to see whats wrong with it. (It's my first time with MySQL so please don't slap me with a trout:P)
You're attempting to insert values which you've defined in the main part of your query, but the values which aren't defined. I ran your query through Notepad++ and tried to count the commas used, found 33 in your table selection part and 32 values attempting to be defined.
Reply

Thanks a lot Calgon! I didn't even notice, it's always the small typo's wich causes the most annoying bugs.
Reply

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
Thanks a lot Calgon! I didn't even notice, it's always the small typo's wich causes the most annoying bugs.
Another set of eyes always helps, 'eh?
Reply

Yes ^_^

<8char>
Reply

I'm using this on a Windows server and it will not connect to the database at all. The settings are correct and I've got everything in it's correct place. I've checked the database, it's accessible... What could be the problem?
Reply

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I'm using this on a Windows server and it will not connect to the database at all. The settings are correct and I've got everything in it's correct place. I've checked the database, it's accessible... What could be the problem?
Does the error log show any errors? (If errors log in this plugin... I can't remember as I use BlueG's plugin)
Reply

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Have any errors returned to mysql_log.txt?
Just saying how it didn't connect. I changed the password on the database and it seems alright now. Not sure what went wrong... The password hasn't been changed in a long time so I don't know what was causing the error. Thanks anyways.
Reply

RealCop; are you using the "fix" version that StrickenKid posted a few posts back? Because I had the same problem with that one. If you are, use the one that's on the main post, that works fine. o.o'
Reply

Sometimes when the value of a field is NULL, mysql_fetch_row crashes the server. I've tried it several times. I guess it is a bug.
Reply

Hi i have a probleme the plugin send report error : Error (0): Function: mysql_connect failed, mysql was not initialized on this handle.

Thanks !
Reply

Great update, im checking back when getting my computer online.. Keep the good work up !
Reply

pawn Код:
[15:16:19] Script[gamemodes/COPSAR~1.amx]: Run time error 19: "File or function is not found"
[15:16:19] Number of vehicle models: 0
i know it means missing plugin or w/e but all i did was overwrite mysql.so with this mysql.so... and upload the new mysql_connect
Reply

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
pawn Код:
[15:16:19] Script[gamemodes/COPSAR~1.amx]: Run time error 19: "File or function is not found"
[15:16:19] Number of vehicle models: 0
i know it means missing plugin or w/e but all i did was overwrite mysql.so with this mysql.so... and upload the new mysql_connect
Re-compile your gamemode with the latest MySQL includes for this plugin and you should be fine.
Reply

did, also i saw this error i guess this is stopping it.

[15:16:19] Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)

theres no libmysqlclient_r.so in the download?
Reply

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
did, also i saw this error i guess this is stopping it.

[15:16:19] Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)

theres no libmysqlclient_r.so in the download?
Read the first page:

Quote:

Running on Linux?

Having problems with libmysqlclient_r.so.X?

First of all, you must locate where your mysql libraries are located.
Mine are located at: /usr/local/mysql/lib/mysql
Now, open libc.conf located in /etc/ld.so.conf.d
Add the mysql libraries' path to the end of this file, on a new line.
Save the file, and execute: ldconfig
Reply

its serverffs, i guess i'll go make a ticket

can someone send me v2.0?
Reply

Quote:
Originally Posted by StrickenKid
Посмотреть сообщение
You have the auto_reconnect and the handle param mixed. Try:

pawn Код:
new MySQL:connection;

public OnGameModeInit()
{
    connection = mysql_init(LOG_ONLY_ERRORS, 1);
    mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, connection, 1);
    ...
}
Thank you, that fixed it!

The parameter info on the wiki page appears to be mixed up:

Quote:

Parameters:
(const host[], const user[], const pass[], const db[], auto_reconnect, MySQL:handle)

Reply

I always get this error when i start server and load the plugin:
Код:
[19:35:27]  Loading plugin: libmysql
[19:35:27]   Plugin does not conform to architecture.
[19:35:27]   Failed.
plz help me! i got a FS that uses MySQL and it wont work, idk if its cuz this wont work or a script error.(FS: https://sampforum.blast.hk/showthread.php?tid=98074 )
Reply

does anyone have v2.0? please send the download link ;\
Reply

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
does anyone have v2.0? please send the download link ;\
Hello,

Here you have (wanted to reupload them, but found the links before):

http://www.strickenkid.info/mysql_plugin/2.X/

Linux: http://www.strickenkid.info/mysql_pl...nux_2.0.tar.gz
Windows: http://www.strickenkid.info/mysql_pl...indows_2.0.rar
Source: http://www.strickenkid.info/mysql_pl...source_2.0.rar
Reply


Forum Jump:


Users browsing this thread: 9 Guest(s)