Saving car information
#15

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
@ JaTochNietDan; Wouldn't using "sscanf" be a better option though? Instead of 20+ lines for one function, why not ~7 lines, most likely going a hell of a lot faster?

Example;

pawn Код:
stock LoadVehiclesFromDatabase()
{
    new str[256], index;
    mysql_query("SELECT * FROM `Vehicles`");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(str))
        {
            sscanf(str, "e<p<|>dffffdd>", Vehicles[index]);
            CreateVehicle(Vehicles[index][vModelID], Vehicles[index][vPositionX], Vehicles[index][vPositionY], Vehicles[index][vPositionZ], Vehicles[index][vAngleZ], Vehicles[index][vColor1], Vehicles[index][vColor2], -1);
            index++;
        }
    }
    mysql_free_result();
    print("\n");
    printf("SERVER: Loaded %d MySQL vehicles successfully.", index);
    return 1;
}
Sure, if he was trying to select information from the database, but in fact that is not what this topic is about, this topic is about updating information in the database, and the method he uses is just fine, all it does is build a string and execute it all at the same time.

Anyway as for the original poster, I think you need to look into MySQL a bit more and understand that the functions you're using are created for certain table designs and won't work with any random new table you've created, you'll have to create separate similar functions for that this particular method you're using to work with your new car information table, as the columns, table name etc are different.
Reply


Messages In This Thread
Saving car information - by Typhome - 16.11.2010, 17:38
Re: Saving car information - by JaTochNietDan - 16.11.2010, 18:31
Re: Saving car information - by Grim_ - 16.11.2010, 18:37
Re: Saving car information - by Typhome - 16.11.2010, 18:55
Re: Saving car information - by Grim_ - 16.11.2010, 18:59
Re: Saving car information - by JaTochNietDan - 16.11.2010, 19:00
Re: Saving car information - by Typhome - 16.11.2010, 19:39
Re: Saving car information - by JaTochNietDan - 16.11.2010, 20:40
Re: Saving car information - by Typhome - 16.11.2010, 21:25
Re: Saving car information - by JaTochNietDan - 16.11.2010, 21:50
Re: Saving car information - by Typhome - 17.11.2010, 15:22
Re: Saving car information - by Typhome - 18.11.2010, 22:45
Re: Saving car information - by NewbBeginner - 18.11.2010, 22:46
Re: Saving car information - by Scenario - 18.11.2010, 22:51
Re: Saving car information - by JaTochNietDan - 18.11.2010, 23:23
Re: Saving car information - by Scenario - 19.11.2010, 01:15
Re: Saving car information - by Typhome - 20.11.2010, 20:02
Re: Saving car information - by Typhome - 21.11.2010, 10:21
Re: Saving car information - by NewbBeginner - 21.11.2010, 10:56
Re: Saving car information - by Typhome - 21.11.2010, 12:18

Forum Jump:


Users browsing this thread: 1 Guest(s)