escaping format directive sprintf()
Posted: Tue Oct 14, 2003 1:38 pm
Hello,
i have the following variable which is a query code fo mysql
I'm using sprintf() to format the string
However i get an Error
can i false a variable inorder to sprintf()? i.e. sprint($var,$var1,$var = false);?
Kendall
i have the following variable which is a query code fo mysql
Code: Select all
$query = "SELECT *, DATE_FORMAT(Date, '\\%d \\%m \\%Y') AS theDATE FROM online_events WHERE MATCH(Title,Description) AGAINST('%s') OR MONTH(Date) = '%s' OR YEAR(Date) = '%s' OR DAY('%s') ORDER BY Date ASC";Code: Select all
$query = printf($query,$term,$month,$year,$day);i'm thinking its theWarning: printf(): Too few arguments in
so i'm trying to escape it but still get the error....how does sprintf() react if some of the arguments are NULL? does it strill try to formatDATE_FORMAT(Date, '\\%d \\%m \\%Y') AS theDATE
can i false a variable inorder to sprintf()? i.e. sprint($var,$var1,$var = false);?
Kendall