[Help] MySQL & PHP
This is simple code, 1 KILL = 1 GOLD saved in MySQL database
PHP Code:
PHP Code:
PHP Code:
|
Re: [Help] MySQL & PHP
Are you sure that the golds column is the second one returned in your query? You should maybe specify the column in the query instead of using "*".
Edit: I'm not sure if this is the cause of your issue, but you need to try things like this to debug. PHP Code:
PHP Code:
|
Re: [Help] MySQL & PHP
Quote:
But when I add golds from server using cmd amx_golds, golds are saved permanently. |
Re: [Help] MySQL & PHP
After you change map, is the data still correct in the database?
|
Re: [Help] MySQL & PHP
After I change map, golds from php page are removed in database too...
And now plugin register same client (SteamID) 2 times :/ |
Re: [Help] MySQL & PHP
Your plugin works fine for me. One thing you should do is make SteamID your primary key. I did this and a few other fixes in the below:
PHP Code:
|
Re: [Help] MySQL & PHP
Not working again :/
Did you test with PHP too ? |
Re: [Help] MySQL & PHP
No, I only tested that the plugin is working correctly. I do not know php, but there's a chance that data is getting lost in that UPDATE statement.
|
Re: [Help] MySQL & PHP
AMXX plugin works fine... Golds are saved and I don't have problem with that :D But I want to add golds from PHP Page.
If I kill 100 Player, I will get 100 GOLDS and that golds are saved in database. When I add +100 golds from php page, then in database I see 200 GOLDS. When I change map, my golds are set to 100 again. WHYY ?? |
Re: [Help] MySQL & PHP
Because the plugin does not know that you made a change on the website.
Here's what is happening: In the game, player gets gGolds[ id ] = 100 php site changes this player golds to 200 On map change, player disconnects and it saves whatever is held in gGolds[] (100). It does not know that you changed the golds to 200 on the php. Maybe you should create 2 variables to store golds. One stores all golds, other stores golds for just the connection. Then in the SQL save query, do: formatex(szTemp,charsmax(szTemp),"UPDATE save_golds SET Golds = Golds + %i WHERE `SteamID` = '%s';", gCurrentGolds[ id ] , g_szAuthID[ id ] ) gCurrentGolds[id] is set to 0 on connect and it does not get loaded from database. Does this make sense? |
| All times are GMT -4. The time now is 09:25. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.