Re: need help to build a query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






On Mon, October 9, 2006 3:09 pm, afan@xxxxxxxx wrote:
> But, in this case I will have repeating order_date and order_status
> info?
>
> id    order_date    status    file_name
> 12    2006-10-09    live      file1.jpg
> 12    2006-10-09    live      file2.jpg
> 12    2006-10-09    live      file3.jpg
> 13    2006-10-09    live      file1.jpg
> 14    2006-10-09    live      test.gif

Yes.

But what you print out and what you have in each result row need not
be exactly one-to-one.

$last_order_id = '';
while (... mysql_fetch_row($result)){
  if ($last_order_id != $order_id){
    echo "$order_id $order_date $status<br />\n";
    $last_order_id = $order_id;
  }
  echo "          $file_name<br />\n";
}

Here we only print out the order_id etc when the order_id changes, not
for every uploaded file.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux