I need a little help
#1

PHP код:
stock LoadBusinesses()
{
    for(new 
BizzID 0BizzID MAX_BUSINESSESBizzID++)
    {
        new 
query[300], savingstring[200], ifnotowned[144], ifisowned[144];
        
format(querysizeof(query), "SELECT * FROM Businesses WHERE ID ='%d' LIMIT 1"BizzID);
        
mysql_query(query);
        
mysql_store_result();
        if(
mysql_num_rows() != 0)
        {
            
mysql_fetch_row(query);
            
mysql_fetch_field_row(savingstring"Price"); BusinessInfo[BizzID][bPrice] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Interior"); BusinessInfo[BizzID][bInterior] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Owned"); BusinessInfo[BizzID][bOwned] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Owner"); BusinessInfo[BizzID][bOwner] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Stored"); BusinessInfo[BizzID][bStored] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"X"); BusinessInfo[BizzID][bX] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Y"); BusinessInfo[BizzID][bY] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Z"); BusinessInfo[BizzID][bZ] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"EnterX"); BusinessInfo[BizzID][bEnterX] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"EnterY"); BusinessInfo[BizzID][bEnterY] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"EnterZ"); BusinessInfo[BizzID][bEnterZ] = strval(savingstring);
            
mysql_fetch_field_row(savingstring"Level"); BusinessInfo[BizzID][bLevel] = strval(savingstring);
            if(
BusinessInfo[BizzID][bLevel] == 1)// 24/7
            
{
                
format(ifnotownedsizeof(ifnotowned), "{00FF00}Business ID: {FFFFFF}%d\n{00FF00}Status: {FFFFFF}For Sale\n{00FF00}Price: {FFFFFF}%d$\n{00FF00}Type: {FFFFFF}24/7"BizzIDBusinessInfo[BizzID][bPrice]);
                
format(ifisownedsizeof(ifisowned), "{00FF00}Business ID: {FFFFFF}%d\n{00FF00}Owner: {FFFFFF}%s\n{00FF00}Price: {FFFFFF}%d$\n{00FF00}Type: {FFFFFF}24/7"BizzIDBusinessInfo[BizzID][bOwner], BusinessInfo[BizzID][bPrice]);
            }
            else if(
BusinessInfo[BizzID][bLevel] == 2// Disco
            
{
                
format(ifnotownedsizeof(ifnotowned), "{00FF00}Business ID: {FFFFFF}%d\n{00FF00}Status: {FFFFFF}For Sale\n{00FF00}Price: {FFFFFF}%d$\n{00FF00}Type: {FFFFFF}Disco"BizzIDBusinessInfo[BizzID][bPrice]);
                
format(ifisownedsizeof(ifisowned), "{00FF00}Business ID: {FFFFFF}%d\n{00FF00}Owner: {FFFFFF}%s\n{00FF00}Price: {FFFFFF}%d$\n{00FF00}Type: {FFFFFF}Disco"BizzIDBusinessInfo[BizzID][bOwner], BusinessInfo[BizzID][bPrice]);
            }
            else if(
BusinessInfo[BizzID][bLevel] == 3// Bar
            
{
                
format(ifnotownedsizeof(ifnotowned), "{00FF00}Business ID: {FFFFFF}%d\n{00FF00}Status: {FFFFFF}For Sale\n{00FF00}Price: {FFFFFF}%d$\n{00FF00}Type: {FFFFFF}Bar"BizzIDBusinessInfo[BizzID][bPrice]);
                
format(ifisownedsizeof(ifisowned), "{00FF00}Business ID: {FFFFFF}%d\n{00FF00}Owner: {FFFFFF}%s\n{00FF00}Price: {FFFFFF}%d$\n{00FF00}Type: {FFFFFF}Bar"BizzIDBusinessInfo[BizzID][bOwner], BusinessInfo[BizzID][bPrice]);
            }
            if(
BusinessInfo[BizzID][bOwned] == 0)
            {
                
BusinessInfo[BizzID][bPick] = CreatePickup(13181BusinessInfo[BizzID][bX], BusinessInfo[BizzID][bY], BusinessInfo[BizzID][bZ], 0);
                
BusinessInfo[BizzID][bLabel] = Create3DTextLabel(ifnotowned0xFFFFFFFFBusinessInfo[BizzID][bX], BusinessInfo[BizzID][bY], BusinessInfo[BizzID][bZ], 25.000);
            }
            else if(
BusinessInfo[BizzID][bOwned] == 1)
            {
                
BusinessInfo[BizzID][bPick] = CreatePickup(13181BusinessInfo[BizzID][bX], BusinessInfo[BizzID][bY], BusinessInfo[BizzID][bZ], 0);
                
BusinessInfo[BizzID][bLabel] = Create3DTextLabel(ifisowned0xFFFFFFFFBusinessInfo[BizzID][bX], BusinessInfo[BizzID][bY], BusinessInfo[BizzID][bZ], 25.000);
            }
            
businessid++;
        }
    }
    
printf("LOADED BIZZS: %d/%d"businessidMAX_BUSINESSES);
    
mysql_free_result();
}
// ---------- 
no errors and mysql database is working well..
but it doesn't create any business.. i can't find the problem.. help?
Reply
#2

What does it say in the console? Does the line 'LOADED BIZZS: xx/xx" show up at all? If it does and there are 0 businesses, then you probably don't have any entries in your SQL database.
Reply
#3

@Jstylezzz
Thanks for the reply! It appears and is showing right information
Reply
#4

bump
Reply
#5

Your query only retrieves 1 result from the database.
PHP код:
format(querysizeof(query), "SELECT * FROM Businesses WHERE ID ='%d' LIMIT 1"BizzID); 
If you want all of the results to be retrieved, remove the 'LIMIT 1' from the query. If you're testing it with this one business, I advise you to use 'printf' to print out values of the retrieved coordinates. Check if they match the records from your DB.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)