O Dear i seems to have got something wrong
#1

Ok guys and girls,i seem to have made a error somewhere,but i'l be danmed if i can find it,so i hoping someone here will be nice enough to help me
This is the piece of code im having problems with

Код:
stock loadBusiness(){
    new Query[1024],
        BizzName,
        Float:Pos[3],
        Price,
        Sell,
        Earnings;
    mysql_query("SELECT * FROM `Business` WHERE `BizID` < "#MAX_BUSINESS" ORDER BY BizID");
    mysql_store_result();
    if(mysql_num_rows() > 0) {
        while(mysql_fetch_row(Query)) {
            sscanf(Query, "p<|>is[26]fffiii",
                BizID, BizzName, Pos[0], Pos[1], Pos[2], Price, Sell, Earnings);
            printf("ID:%i\t", BizID);
            BizzInfo[BizID][BizName] = BizzName;                     printf("Name:%s\t", BizzName);
            format(BizzInfo[BizID][BizName], 60, "%s", BizzName);
            BizzInfo[BizID][BizX] = Pos[0];                          printf("X:%f\t", Pos[0]);
            BizzInfo[BizID][BizY] = Pos[1];                          printf("Y:%f\t", Pos[1]);
            BizzInfo[BizID][BizZ] = Pos[2];                          printf("Z:%f\t", Pos[2]);
            BizzInfo[BizID][BizPrice] = Price;                       printf("Price:$%i\t", Price);
            BizzInfo[BizID][BizSell] = Sell;                         printf("Sell:$%i\t", Sell);
            BizzInfo[BizID][BizEarning] = Earnings;                  printf("Earnings:$%i\t\t", Earnings);
            BizPickup[BizID] = CreatePickup(1272, 1, Pos[0], Pos[1], Pos[2]);
            BizzInfo[BizID][BizExists] = 1;
            BizzInfo[BizID][BizIsEnabled] = 1;
            if(PayoutTimer == -1) {
                PayoutTimer = SetTimer("BizPayout", (BizPayoutFrequency*1000), 1);
                for(new i=1; i<MAX_BUSINESS; i++) {
                    BizzInfo[i][BizOwner] = -1;}}
			++ Total_Biz_Created;}}
    mysql_free_result();
    print("\n==============================================================");
    printf("** A total of: \"%i\" Business(s) were loaded!", Total_Biz_Created);
    print("==============================================================\n");
    return Total_Biz_Created;}
And so the Mysql debug come up with this
Код:
[22:22:27] CMySQLHandler::FetchRow() - Return: 130|Popes Holy Hideaway|2491.38|918.52|20.79|870000|391737|18000
130 is the id and this is where im having problems,but on the biz count it is coming up with this
Код:
[08/01/2012 22:22:54] ** A total of: "126" Business(s) were loaded!
Well i now for a fact there is 130 business in the server,because i can teleport to it,and it doesnt miss any other business either,so could some one shed so light into what i have done wrong
I only really found this problem when i tried to create a new biz and it tried to create a new id127,which failed as id127 is already there in the database.

And thank you for any help given
Reply
#2

In your sscanf statement BizzName is marked as a string, but you have initialized it as an integer.
Reply
#3

Sorry its taken me so long to get back,i been busy at work
Quote:
Originally Posted by Vince
Посмотреть сообщение
In your sscanf statement BizzName is marked as a string, but you have initialized it as an integer.
ok i have understood the first statment 'string'
Код:
sscanf(Query, "p<|>is[26]fffiii"
But its the second part im not getting ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)