Dont print ROW MYSQL
#1

This is my bizz system, created ingame, and updated in time (atlest before)
I think i made something wrong and it's not updating anymore, using printf i found where it not work
The code is not working in here:

if(rows) {
em:
public Carregar_Business(bizzid) {

It's printing:
created
loading ID
but ROW is not printing

Anybody know how to fix?

Full code:
PHP код:
CMD:makebizz(playerid, params[]) {
    new 
bizzid, name[30], type;
    if(
sscanf(params,"iis[30]", bizzid, type, name)) {
        
SendClientMessage(playerid, -1, "Use: /makebizz [id] [type] [name]");
        return 
1;
    }
    if(
bizzid < 1 && bizzid > MAX_BIZZ) return SendClientMessage(playerid, -1, "Choose a number between 1-MAX_BIZZ");
    if(
strlen(name) > 30) return SendClientMessage(playerid, -1, "The name can not have more then 30 caracters");
    new 
Float:x, Float:y, Float:z;
    
GetPlayerPos(playerid, x, y, z);
    
BizzInfo[bizzid][bizzX] = x;
    
BizzInfo[bizzid][bizzY] = y;
    
BizzInfo[bizzid][bizzZ] = z;
    
BizzInfo[bizzid][bizzName] = name;
    
BizzInfo[bizzid][bizzType] = type;
    
BizzInfo[bizzid][bizzID] = bizzid;
    new 
query[1030];
    
mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `business` SET `bizzType` = '%d', `bizzX` = '%f', `bizzY` = '%f', `bizzZ` = '%f', `bizzName` = '%s', `bizzOWNER` = '%d' WHERE `bizzID` = '%i'",
        
BizzInfo[bizzid][bizzType],
        
BizzInfo[bizzid][bizzX],
        
BizzInfo[bizzid][bizzY],
        
BizzInfo[bizzid][bizzZ],
        
BizzInfo[bizzid][bizzName],
        
BizzInfo[bizzid][bizzOWNER],
    
bizzid);
    
mysql_pquery(ConnectMYSQL, query);
    
printf("created");
    
Carregar_Business(bizzid);
    return 
1;
} 
PHP код:
forward Carregar_Business(bizzid);
public 
Carregar_Business(bizzid) {
    
printf("loading %i", bizzid);
    new 
string[256], rows, fields;
    
cache_get_row_count(rows);
    
cache_get_field_count(fields);
    if(
rows) {
          
printf("ROW");
          
// ints
          
cache_get_value_int(0, "bizzID", BizzInfo[bizzid][bizzID]);
          
cache_get_value_int(0, "bizzType", BizzInfo[bizzid][bizzType]);
          
cache_get_value_int(0, "bizzOWNER", BizzInfo[bizzid][bizzOWNER]);
        
// floats
        
cache_get_value_float(0, "bizzX", BizzInfo[bizzid][bizzX]);
        
cache_get_value_float(0, "bizzY", BizzInfo[bizzid][bizzY]);
        
cache_get_value_float(0, "bizzZ", BizzInfo[bizzid][bizzZ]);
        
// strings
        
cache_get_value_name(0, "bizzName", BizzInfo[bizzid][bizzName], 30);
        
// pickup
        
if(BizzInfo[bizzid][bizzType] != 0) {
            
DestroyDynamicPickup(PickupBizz[bizzid]);
            
DestroyDynamic3DTextLabel(Text3Dbizz[bizzid]);
            
format(string, sizeof(string), "(BID:%i)%s.\nPress 'F' to enter.",  BizzInfo[bizzid][bizzID], BizzInfo[bizzid][bizzName]);
            
Text3Dbizz[bizzid] = CreateDynamic3DTextLabel(string, 0xABDEACFF, BizzInfo[bizzid][bizzX], BizzInfo[bizzid][bizzY], BizzInfo[bizzid][bizzZ], 10.0);
            
PickupBizz[bizzid] = CreateDynamicPickup(1239, 1, BizzInfo[bizzid][bizzX], BizzInfo[bizzid][bizzY], BizzInfo[bizzid][bizzZ], -1);
        }
    }
} 
Reply
#2

bump
Reply
#3

What mysql version are you using, What happens is that it does not load the business on the server?
Reply
#4

This is no how mysql_pquery works. You need to use the callback inside of mysql_pquery. To make use of what you have in that function you need SELECT not UPDATE Also no idea what you trying to do, UPDATE is not creating INSERT INTO is
Reply
#5

Carregar_Business(bizzid);
replace it with tquery
PHP код:
mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM `business` WHERE `bizzID` = '%i'", bizzid);
mysql_tquery(ConnectMYSQL, query, "Carregar_Business", "d", bizzid); 
Reply
#6

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Carregar_Business(bizzid);
replace it with tquery
PHP код:
mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM `business` WHERE `bizzID` = '%i'", bizzid);
mysql_tquery(ConnectMYSQL, query, "Carregar_Business", "d", bizzid); 
I already found that, but thank you to help, i just added a LIMIT 1 in the end.
Thank you! +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)