Re: [PHP] How to get 2 columns to display?

2004-12-06 Thread bbonkosk
You need a way to make new table rows...

if you want to do it ever other image, then just add a counter variable, 
incrememnt it each time and if it is even then make a new table row.

(Also if the images are two big, the browser may put them on a new line, so you 
might have to look into shrinking the images..)
-B

- Original Message -
From: Aaron Wolski [EMAIL PROTECTED]
Date: Monday, December 6, 2004 9:20 am
Subject: [PHP] How to get 2 columns to display?

 Hi guys,
 
 I'm trying to get two columns of td/td to display side by side and
 then go to a new row. I am using this code but nothing I seem to 
 do is
 working this far. 
 
 ?php
 for ($r=0;$products = db_fetch($productsQuery);$r++)
 {
 ?
  td align=centerproducts/?php
 echo $category; ?/?php echo $products['name_url']; ?
 class=product_linkimg src=?php echo $base_url;
 ?product_images/thumbs/?php echo $products['thumb']; ? border=0
 width=159br?php echo $products['name']; ?/td ?php  if
 ((($r+1) % 2) == 0)
 { 
 ?
/tr
tr valign=top
 ?php
 }
 }
 ?
 
 What is happening with this code is I am getting results like:
 
 tr
   tdIMAGE HERE/td
   tdIMAGE HERE/td
   tdIMAGE HERE/td
   tdIMAGE HERE/td
   tdIMAGE HERE/td
 /tr
 
 What I WANT is:
 
 tr
   tdIMAGE HERE/td
   tdIMAGE HERE/td
 /tr
   tdIMAGE HERE/td
   tdIMAGE HERE/td
 /tr
   tdIMAGE HERE/td
   td/td
 /tr
 
 ANY clue where I am going wrong?
 
 Thanks so much.
 
 Aaron
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



RE: [PHP] How to get 2 columns to display?

2004-12-06 Thread Jack . van . Zanen
can you maybe add some debug code to print out the value of $r just before
the if?
and just after the if

It looks at first glance to be correct, except you seem to be missing
opening TR (actually that may be your problem)

Jack

-Oorspronkelijk bericht-
Van: Aaron Wolski [mailto:[EMAIL PROTECTED]
Verzonden: maandag 6 december 2004 15:21
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] How to get 2 columns to display?


Hi guys,

I'm trying to get two columns of td/td to display side by side and
then go to a new row. I am using this code but nothing I seem to do is
working this far. 

?php
for ($r=0;$products = db_fetch($productsQuery);$r++)
{
?
  td align=centera href=?php echo $base_url; ?products/?php
echo $category; ?/?php echo $products['name_url']; ?
class=product_linkimg src=?php echo $base_url;
?product_images/thumbs/?php echo $products['thumb']; ? border=0
width=159br?php echo $products['name']; ?/a/td ?php  if
((($r+1) % 2) == 0)
 {  
?
/tr
tr valign=top
?php
 }
}
?

What is happening with this code is I am getting results like:

tr
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr

What I WANT is:

tr
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
tdIMAGE HERE/td
td/td
/tr

ANY clue where I am going wrong?

Thanks so much.

Aaron

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

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