Using a literal "%" in a format (MySQL)
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
try doing dat sir:
PHP код:
mysql_escape_string(namestring); 
then
PHP код:
mysql_format(mysqlquerysizeof(query), "SELECT `Username`, `Registration`, `IP`, `Score` FROM `Users` WHERE `Username` LIKE '%%%s%%' LIMIT %d"stringamount); 
print(
query); 
however in your code you was formating string and using name instead of string .-.
Код:
format(string, sizeof(string), "%%%s%%", name); 
    mysql_format(mysql, query, sizeof(query), "SELECT `Username`, `Registration`, `IP`, `Score` FROM `Users` WHERE `Username` LIKE '%e' LIMIT %d", name, amount); 
    print(query);
its supposed to be:
PHP код:
format(stringsizeof(string), "%%%s%%"name); 
    
mysql_format(mysqlquerysizeof(query), "SELECT `Username`, `Registration`, `IP`, `Score` FROM `Users` WHERE `Username` LIKE '%e' LIMIT %d"stringamount); 
    print(
query); 
Works smoothly mate, thank you
BTW, Escaping a string actually makes it longer or shorter ?
P.S Can't rep sorry
Reply


Messages In This Thread
Using a literal "%" in a format (MySQL) - by NeXoR - 03.11.2016, 19:57
Re: Using a literal "%" in a format (MySQL) - by jlalt - 03.11.2016, 20:04
Re: Using a literal "%" in a format (MySQL) - by NeXoR - 03.11.2016, 20:12
Re: Using a literal "%" in a format (MySQL) - by Konstantinos - 03.11.2016, 20:14
Re: Using a literal "%" in a format (MySQL) - by NeXoR - 03.11.2016, 20:18

Forum Jump:


Users browsing this thread: 1 Guest(s)