Re: puzzleing problem

From: Date: Sat, 10 May 2003 06:37:38 +0000
Subject: Re: puzzleing problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147098@lists.php.net to get a copy of this message
Hi, Saturday, May 10, 2003, 10:36:36 AM, you wrote: RA> Hi guys, RA> Have a puzzleing problem...see if you can help me out. RA> I visited a site called "hostfilter.com" as I am making a simular site but RA> am confused by one of their functions in the search page.... RA> their results page is pretty straight forward except for one thing... RA> normally I would execute an sql something like this for that result: RA> select * from sometable where price<=5 and platform=unix and space=10 RA> then format the resultset into a nice table so it gives me: RA> $package $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc RA> $company-For-The-Above-Package RA> BUT how is he getting: RA> $package $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc RA> $package2 $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc RA> $package3 $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc RA> $company-For-The-Above-Package RA> whenever i try my sql i keep getting the $company-For-The-Above-Package RA> appearing after every line instaed of once the way its in hostfilter.com's RA> result... RA> Am wondering if he is using some special sql or is it an ASP feature and RA> more importantly how do i do it in PHP? RA> Any ideas? RA> Please reply. RA> Thanks, RA> -Ryan Just do a comparison on $company-For-The-Above-Package and when it changes output the old one and carry on. $company-For-The-Above-Package = ''; while(get db reults){ if(empty($company-For-The-Above-Package)){ $company-For-The-Above-Package = company; }elseif($company-For-The-Above-Package != $company) output $company-For-The-Above-Package $company-For-The-Above-Package = $company; } output row info } -- regards, Tom

« previous php.general (#147098) next »