?
Solved

Display Two Columns Per Row - Then Start a New Row

Posted on 2007-04-03
3
Medium Priority
?
256 Views
Last Modified: 2012-05-05
Can someone take a quick look and see what I'm missing or why this isn't working the way I want it to?  I want to have two columns displayed per row and then start a new row.  Here's my code snippet:

//Query is here.

?>
  <table style="width: 80%; text-align: left; margin-left: 25%; margin-right: auto;" border="0" >
<?
while ($myfieldarray = mysql_fetch_assoc($query)) {
      if ( (intval($myfieldarray['id']) % 2) == 0 ) {
      ?>  <?
      } else {
      ?>
       <tr>
      <? } ?>
            <td align="right" width="325">
            <label><?=$myfieldarray['cTradeName']?></label>
            </td>
            <td align="left">
            <input type="checkbox" name="chkbox<?=$myfieldarray['id']?>" id="<?=$myfieldarray['id']?>" <?php isItChecked($myfieldarray['id'], $UserRecid) ?> >
            </td>
      <?
    if ( (intval($myfieldarray['id']) % 2) == 0 ) {
      ?>  <?
      } else {
      ?> </tr> <?
      }
} ?>
   </table>
0
Comment
Question by:Quetysis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Accepted Solution

by:
TeRReF earned 2000 total points
ID: 18845065
I think it should be something like:

  <table style="width: 80%; text-align: left; margin-left: 25%; margin-right: auto;" border="0" >
<?
while ($myfieldarray = mysql_fetch_assoc($query)) {
      if ( (intval($myfieldarray['id']) % 2) != 0 ) {
      ?>
       <tr>
      <? } ?>
            <td align="right" width="325">
            <label><?=$myfieldarray['cTradeName']?></label>
            </td>
            <td align="left">
            <input type="checkbox" name="chkbox<?=$myfieldarray['id']?>" id="<?=$myfieldarray['id']?>" <?php isItChecked($myfieldarray['id'], $UserRecid) ?> >
            </td>
      <?
    if ( (intval($myfieldarray['id']) % 2) == 0 ) {
      ?> </tr> <?
      }
} ?>
   </table>

0
 

Author Comment

by:Quetysis
ID: 18845156
Thanks!  That did it!
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 18845605
@TeRReF,

Did you receive my email?
0

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question