MySQL saving/updating problem
#1

The script below works almost completely. But the problem after a Player set his house name, the house name saves but the House ID is not saving correctly. It shows -255 in the mysql_logs.

MYSQL_LOG
Quote:

[22:30:28] CMySQLHandler::Query(resultID) - Threaded query with id 18 started. (Extra ID: 0)

[22:30:28] CMySQLHandler::ProcessQueryThread(UPDATE `houses` SET `HName` = 'test' WHERE `HouseID` = '-255') - Data is getting passed to OnQueryFinish() - (Threadsafe: Yes)

[22:30:28] OnQueryFinish(18,"UPDATE `houses` SET `HName` = 'test' WHERE `HouseID` = '-255'") - Called.

HOUSE NAME SCRIPT
PHP код:
            if(strlen(inputtext) > 2 && strlen(inputtext) < 21)
            {
                new 
housenumber = GetHouseID( playerid );
                if ( 
strcmp( GetGVarStringEx( "h_Owner", housenumber ), PlayerName( playerid ), false ) )
                return 
SendClientMessage( playerid, -1,""SV_RD"» {c8c8c8}This house isn't yours!" );
                
format( gsQuery, sizeof gsQuery, "UPDATE `houses` SET `HName` = '%s' WHERE `HouseID` = '%d'", inputtext, housenumber );
                
mysql_query( gsQuery, THREAD_NONE, playerid );
                
SetGVarString( "h_name", "%s", housenumber );
                
format( gsString, sizeof( gsString ), ""W"Press "ORANGE_"H "W"key to Enter the House\n"SV_BL"House Name: "W"%s\n"SV_BL"House Owner: "W"%s\n "SV_BL"House Value: "W"%d$\n "SV_BL"House Privacy: "RED_"Closed\n"SV_BL"House ID: "ORANGE_"%d",GetGVarStringEx( "h_name", housenumber ), PlayerName(playerid), GetGVarInt( "h_Cost", housenumber),housenumber);
                
UpdateDynamic3DTextLabelText( Text3D:GetGVarInt( "House3DText", housenumber ), 0xFF9900FF, gsString );
            }
              else
            {
                 
SendClientMessage(playerid, COLOR_RED, "Error: {ffffff}You must enter 2-20 Character.");
                 
ShowPlayerDialog(playerid, DIALOG_HOUSE_NAME, DIALOG_STYLE_INPUT, "House Name", "Write a new name for this house:\n\n{E74C3C}The name you entered is either too short or too long.", "Change", "Back");
            } 
Reply


Messages In This Thread
MySQL Settimer with string - by kampuman - 27.07.2016, 18:35
Re: MySQL saving/updating problem - by ThePhenix - 27.07.2016, 18:40
Re: MySQL saving/updating problem - by kampuman - 27.07.2016, 18:48
Re: MySQL saving/updating problem - by [MG]Dimi - 27.07.2016, 20:07
Re: MySQL saving/updating problem - by kampuman - 27.07.2016, 20:27
Re: MySQL saving/updating problem - by ThePhenix - 27.07.2016, 20:48
Re: MySQL saving/updating problem - by kampuman - 27.07.2016, 21:09
Re: MySQL saving/updating problem - by kampuman - 28.07.2016, 01:00
Re: MySQL saving/updating problem - by Dragony92 - 28.07.2016, 02:05
Re: MySQL saving/updating problem - by kampuman - 28.07.2016, 06:35

Forum Jump:


Users browsing this thread: 1 Guest(s)