How to make it short ?
#1

PHP код:
query_string "";
    
format(query_string,sizeof(query_string),"SELECT `t1`.`HouseID` AS `HouseID`, `t1`.`OwnedBy` AS `OwnedBy`, `t1`.`Location` AS `Location`, `t1`.`DefaultPrice` AS `DefaultPrice`, `t1`.`Price` AS `Price`, `t1`.`Interior` AS `Interior`,`t1`.`iX` AS `iX`,`t1`.`iY` AS `iY`,`t1`.`iZ` AS `iZ`,`t1`.`eX` AS `eX`,`t1`.`eY` AS `eY`,`t1`.`eZ` AS `eZ`,`t1`.`Slots` AS `Slots`,`t1`.`ForSale` AS `ForSale`,`t1`.`Locked` AS `Locked`,if((unix_timestamp(str_to_date(`t2`.`lastlogin`,'%e/%c/%Y %k:%i:%s')) > (unix_timestamp() - (((if((`t2`.`vip` > 0),%d,if((`t2`.`totalscore` >= %d),%d,%d)) * 24) * 60) * 60))),1,0) AS `OwnerActive` FROM (`houses` `t1` join `users` `t2`) WHERE (`t1`.`OwnedBy` = `t2`.`username`)UNION SELECT `t1`.`HouseID` AS `HouseID`, `t1`.`OwnedBy` AS `OwnedBy`, `t1`.`Location` AS `Location`, `t1`.`DefaultPrice` AS `DefaultPrice`, `t1`.`Price` AS `Price`, `t1`.`Interior` AS `Interior`, `t1`.`iX` AS `iX`, `t1`.`iY` AS `iY`, `t1`.`iZ` AS `iZ`, `t1`.`eX` AS `eX`, `t1`.`eY` AS `eY`, `t1`.`eZ` AS `eZ`, `t1`.`Slots` AS `Slots`, `t1`.`ForSale` AS `ForSale`, `t1`.`Locked` AS `Locked`, 1 AS `OwnerActive` FROM `houses` `t1` WHERE (`t1`.`OwnedBy` = 'None')"DAYS_WHEN_VIPMIN_SCORE_NECESSARYDAYS_WHEN_NORMAL_PLAYERDAYS_WHEN_SCORE_REACHED);
    
mysql_query(query_string); 
I am getting 5 errors so i have to make it short
Reply
#2

What errors ... provide more info.

If by making it short you mean that the string is too long, you can insert line breaks:

PHP код:
"1. Line\
Second line\
Third line." 
Reply
#3

Код:
C:\Users\Farha\Desktop\Server\gamemodes\saa.pwn(218) : warning 201: redefinition of constant/macro (symbol "SetPlayerPos")
C:\Users\Farha\Desktop\Server\gamemodes\saa.pwn(2852) : error 075: input line too long (after substitutions)
C:\Users\Farha\Desktop\Server\gamemodes\saa.pwn(2853) : error 037: invalid string (possibly non-terminated string)
C:\Users\Farha\Desktop\Server\gamemodes\saa.pwn(2853) : error 017: undefined symbol "SELECT"
C:\Users\Farha\Desktop\Server\gamemodes\saa.pwn(2853) : error 029: invalid expression, assumed zero
C:\Users\Farha\Desktop\Server\gamemodes\saa.pwn(2853) : fatal error 107: too many error messages on one line
break line not working
Reply
#4

Using this, i get no errors:

PHP код:
    new query_string[1400];
    
mysql_format(sqlHandlequery_stringsizeof(query_string),"SELECT `t1`.`HouseID` AS `HouseID`, `t1`.`OwnedBy` AS `OwnedBy`, `t1`.`Location` AS `Location`\
        , `t1`.`DefaultPrice` AS `DefaultPrice`, `t1`.`Price` AS `Price`, `t1`.`Interior` AS `Interior`,`t1`.`iX` AS `iX`,`t1`.`iY` AS `iY`,`t1`\
        .`iZ` AS `iZ`,`t1`.`eX` AS `eX`,`t1`.`eY` AS `eY`,`t1`.`eZ` AS `eZ`,`t1`.`Slots` AS `Slots`,`t1`.`ForSale` AS `ForSale`,`t1`.`Locked` AS `\
        Locked`,if((unix_timestamp(str_to_date(`t2`.`lastlogin`,'%e/%c/%Y %k:%i:%s')) > (unix_timestamp() - (((if((`t2`.`vip` > 0),%d,if((`t2`.`tot\
        alscore` >= %d),%d,%d)) * 24) * 60) * 60))),1,0) AS `OwnerActive` FROM (`houses` `t1` join `users` `t2`) WHERE (`t1`.`OwnedBy` = `t2`.`user\
        name`)UNION SELECT `t1`.`HouseID` AS `HouseID`, `t1`.`OwnedBy` AS `OwnedBy`, `t1`.`Location` AS `Location`, `t1`.`DefaultPrice` AS `DefaultPr\
        ice`, `t1`.`Price` AS `Price`, `t1`.`Interior` AS `Interior`, `t1`.`iX` AS `iX`, `t1`.`iY` AS `iY`, `t1`.`iZ` AS `iZ`, `t1`.`eX` AS `eX`, `t1`\
        .`eY` AS `eY`, `t1`.`eZ` AS `eZ`, `t1`.`Slots` AS `Slots`, `t1`.`ForSale` AS `ForSale`, `t1`.`Locked` AS `Locked`, 1 AS `OwnerActive` FROM `hou\
        ses` `t1` WHERE (`t1`.`OwnedBy` = 'None')"
DAYS_WHEN_VIPMIN_SCORE_NECESSARYDAYS_WHEN_NORMAL_PLAYERDAYS_WHEN_SCORE_REACHED); 
    
mysql_query(sqlHandlequery_string); 
I added line breaks and adapted it to R41-2 (because i couldn't test with an older version, since i have none).

Anyways you are missing arguments, you have got 4 variables at the end but the string has (way more than 4 specifiers)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)