Iain71 wrote:
> In the end it just needed the
> It uses SPRINTF which I'm not quite sure is
Why not consult the PHP online documentation?
http://www.php.net/manual/en/function.sprintf.php
> $query_rsOrders = sprintf("SELECT *,
date_format(OrderDate, '%d %M %Y') as
> formatted_date FROM Orders WHERE OrderCustomerID = %s
ORDER BY OrderID Asc",
> $colname_rsOrders);
> Warning: sprintf() [function.sprintf]: Too few arguments
in
> /home/qdiizyfg/public_html/orderhistory.php on line 52
> Query was empty
sprintf() uses conversion specifications that begin with a
percentage
sign. Your revamped query contains MySQL format specifiers
that also
begin with percentage signs. As a result PHP thinks you have
supplied
too few arguments to sprintf(). When using a literal
percentage sign in
sprintf(), it needs to be escaped with another percentage
sign like this:
$query_rsOrders = sprintf("SELECT *, date_format(OrderDate,
'%%d %%M
%%Y') as formatted_date FROM Orders WHERE OrderCustomerID =
%s ORDER BY
OrderID Asc", $colname_rsOrders);
I'm surprised that your other query worked. Normally the
asterisk cannot
be combined with other column names. Perhaps it's because
you're using
formatted_date as an alias, rather than using the name of the
column
itself. The correct way to specify this sort of query is to
name each
column explicitly.
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/