Database Number of arg

Started by CopyPaste, Jul 16, 2015, 05:08 PM

Previous topic - Next topic

CopyPaste

Same error in parameter and my player teleports to gulf

DizzasTeR

MySQL is not exactly like SQLite, there are a few differences you must see, you are using the wrong way to fetch the data resulting in errors, use this and try to learn how its done with MySQL ;)

if ( cmd == "gotoloc" )
{
        if ( !text ) MessagePlayer( "[ffffff]/gotoloc [location]", player );
        else if ( !player.IsSpawned ) MessagePlayer( "[#ffffff]You must be spawned to use this command.", player );
        else
        {         
                local q = mysql_query( sqLiteDB, "SELECT x, y, z, Creator FROM Gotoloc WHERE Name = '"+ escapeSQLString( text ) +"'" );
                if( mysql_num_rows( q ) == 1 )
                {
                        local result = ::mysql_fetch_assoc( q );
                        local x = result[ "x" ], y = result[ "y" ], z = result[ "z" ], Creator = result[ "Creator" ];
                        player.Pos = Vector( x, y, z );
                        MessagePlayer( "[#FFFFFF]Teleported to location: " + text + " Creator: " + Creator, player );
                }
                else MessagePlayer("[#ffffff]Invalid location", player);
                mysql_free_result( q );
        }
}

CopyPaste