Wait, I think I got you. You want company with the best offer listed first toghether with the company's other offers - and these offers should be ignored in the next comparation.
So now should be listed another company with second best offer - without using the offers from the first company.


Is this how you want it?

Ryan A wrote:

Hi again Marek,

I want the results like this:

  company1
  1plan1 // this is the important one as its the least/most (depending on
DESC or ASC)
  1plan2 // this is all the other plans company1 offers (which meet the sql
parameters)

  company2
  2plan1 // this again is important as its the second least/most (depending
on DESC or ASC)
  2plan2 //this is all the other plans company2 offers (which meet the sql
parameters)


company3 3plan1 // this again is important as its the third least/most (depending on DESC or ASC) 3plan2 //this is all the other plans company3 offers (which meet the sql parameters)

etc

I've pretty much given up on this coz I have been experimenting with
differient code and my brains gone to mush right now...

Thanks for trying.

-Ryan





Still you have shown only how you didn't want the results ordered but
how you want them.

Ryan A wrote:

Hi Marek,
Sorry about the confusion, let me explain.

With default sorting (without $TheOrder) I am getting this:

(using $sqlle = "select * from $table_namee where price <=$max and

spacee


=$min order by custno,price LIMIT $limitvalue1, $limit"; )


company1
1plan1
1plan2

company2
2plan1
2plan2


company3 3plan1 3plan2

etc

Which is the perfect results that I am looking for. This is the code i

am


using to get that output:

if(empty($Tcompany))
{ $Tcompany = $row[4];  }
elseif($Tcompany != $row[4])
{
       //echo plan and html here
       $Tcompany = $row[4];
}

So far so good, I am getting everything exactly the way I want it.


Now I want to give the user an ability to sort the data according to

the


way he wants it....so I am using:
($sqlle = "select * from $table_namee where price <=$max and spacee=$min
order by $TheOrder, custno LIMIT $limitvalue1, $limit)


and the results are coming out jumbled like this:


company1
1plan1

company3
3plan1

company1
1plan2


company2 2plan1 2plan2


I do basically want to order by both (as you said)...first order by $TheOrder and make sure it displays by "company".... Rob from the list said something about caching the result...but I really couldnt understand...am looking into it though.


Any ideas or questions?


Thanks,
-Ryan







Hi again,

I cannot spot any difference from the original that you already have.

Marek

Ryan A wrote:


Hi,
Thanks for replying.

Yes, i know ordering by both at once as if they were on the first

place


is


illogical, thats why I need a php answer to "wangle" this....I want

the


desired output to be the same when the sort by was by default

"price"..eg:



company1
1plan1
1plan2

company2
2plan1
2plan2


company3 3plan1 3plan2

etc

What do you think?

Cheers,
-Ryan





How do you mean it? Order by both at once as if they were on the first
place? Is this logicaly possible?

You should post your desired output.

Marek

Ryan A wrote:



Hi Marek,
Thanks for replying.

If I do that I get the companies neatly but the not sorted according

to


the



$TheOrder...:-(

Yep, am checkign user inputs.

Cheers,
-Ryan








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



Reply via email to