Re: sprintf
| From: | Robert Cummings | Date: | Thu, 07 Nov 2002 19:46:44 +0000 |
| Subject: | Re: sprintf | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123215@lists.php.net to get a copy of this message | ||
$sql = "SELECT * FROM Vacation where StartDate LIKE '%s\\%s'";
That should work :)
Cheers,
Rob.
Tyler BIRD wrote:
>
> hey I'm trying to make dynamic database queries using
> sprintf
> any way I can get around this error?
>
> $sql = "SELECT * FROM Vacation where StartDate LIKE '%s/" .
> '\%' . "/%s'";
> $sql = sprintf($sql, $_GET["month"], $_GET["year"] );
>
> I want just a literal slash between the month and year,
> printf seems to complain of to few
> arguments I've tried escaping the meaning of the % in the
> example above and still
> get errors
>
> Thanks
> TYler
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:robert.cummings@webmotion.com |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'