Re: Screwing up my results...please help
| From: | Marek Kilimajer | Date: | Thu, 23 Oct 2003 10:52:36 +0000 |
| Subject: | Re: Screwing up my results...please help | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167249@lists.php.net to get a copy of this message | ||
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. -RyanStill you have shown only how you didn't want the results ordered but how you want them. Ryan A wrote:spaceeHi 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 andam=$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 itheusing 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 toplaceway 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, -RyanHi 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 firsttheisillogical, thats why I need a php answer to "wangle" this....I wantto"price"..eg:desired output to be the same when the sort by was by defaultcompany1 1plan1 1plan2 company2 2plan1 2plan2 company3 3plan1 3plan2 etc What do you think? Cheers, -RyanHow 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 accordingthe$TheOrder...:-( Yep, am checkign user inputs. Cheers, -Ryan