In message <gstg5o+c...@egroups.com>, pirate_lenny
<piratele...@gmail.com> writes
>--- In php_mysql@yahoogroups.com, John Magee <jema...@...> wrote:
>>
>> 
>> 
>> 
>> On 4/24/09 8:07 AM, "pirate_lenny" <piratele...@...> wrote:
>> 
>> > I've got a layout that I'd like to make two columns. The two columns would
>> > need to be populated by the results of a query.
>> > 
>> > SOOOOO, using LIMIT 2,4 (for example) won't work, because as the 
>information
>> > grows, the limit would need to be changed in the code (I think).

Now that you have given an example, I see what you mean...

>> > 
>> > How would I create two columns that would expand and change depending on 
>the
>> > number of rows returned?

Never done this, but the simple way appears to be

SELECT COUNT(*) FROM...
$totalrecords= count

$displaycounter=0;
SELECT this, that, theother...
while...{
 $displaycounter++;
 if $displaycounter > ($totalrecords/2) {
        end first column - /TD or /div, whichever you are using.
        start second column - TD or div
        $displaycounter= -100; (so it won't end first col again
 }
 echo this, that, theother
} 


Is that what you meant?  

I'll bet someone has a really elegant solution somewhere...
but mine is simple!

-- 
Pete Clark

Got any spare time? Anything you need? Barter in Spain
Join for free at http://BarterWithBart.com

Reply via email to