Solved

Display Two Columns Per Row - Then Start a New Row

Posted on 2007-04-03
3
250 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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

726 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