Hi,
I have a table where a users details are entered for the products he bought,
the only part that is repeated is the order_id,
I basically need to only get the order per person, and paginate for all the
customers
eg:
if user "tom" bought 3 items in the database it would be entered as:
order_id item_name
0000023 soap
0000023 brush
0000023 towel
So i am trying this:
$num_rows = mysql_result(mysql_query("SELECT COUNT(*),
DISTINCT(order_number) FROM ".$prefix."_purchases"),0);
(the idea being taht $num_rows will give my paginating part of the program
the total number of records
that match my search.)
which gives me the most pretty error of:
Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in \www\p\admin\show_purc.php on line 9
I''m pretty sure the problem is in my SQL statement, but have had no luck
searching and reading in the mysql manual for
"count" with "distinct" but am pretty sure it can be done as i have not
found anything saying the opposite...any ideas?
Thanks,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php