Need to present one column of table data into two column layout

Hi all, I am modifying the layout of a webpage that is sent to a printer or PDF.
I have it set up and working to pull the data from one table column, but I want to present it in two columns by simply separating the odd and even rows and displaying them side by side.

This works to pull the data and present it, but it’s all still stacked into one column in the final presentation.

$select_pstructure="select * from pstructure where pid=$id";     
    $result_pstructure=mysql_query($select_pstructure);
    $con_row2=mysql_fetch_array($result_pstructure);
    $pstructure='';
    while($row_pstructure=mysql_fetch_array($result_pstructure))
    {
        $pstructure.="<tr><td>".$row_pstructure['pmessage']."</td></tr>";
    }
    $image2=$con_row2['image_path2'];*

I’ve noodled around with all kinds of options but cannot get it separated and better presented.
Any suggestions??

EDIT
This post has been reformatted by enclosing the code block in 3 backticks
```
on their own lines.

It can be done something like this. Don’t see your <table> tags so added those as well.

$pstructure.="<table>\r";

$cnt=0;
while($row_pstructure=mysql_fetch_array($result_pstructure))
    {
        if($cnt % 2 == 0){
            $pstructure.="<tr>\r";
            $pstructure.="<td>".$row_pstructure['pmessage']."</td>\r";
        }else{
            $pstructure.="<td>".$row_pstructure['pmessage']."</td>\r";
            $pstructure.="</tr>\r";
        }
        $cnt++;
    }
    if($cnt % 2 == 1){
        $pstructure.="<td>&nbsp;</td>\r";
        $pstructure.="</tr>\r";
    }
    
    
    $pstructure.="</table>\r"; 

Thanks a bunch Drummin.
I didn’t think about it, sorry, but there was a call further down in the script to the one I previously posted. Hence the lack of table tag.
I’m noodling around with what you suggested but not getting it to fire yet.

if($pstructure!='')
	 { $pmessage=$pmessage."
	 <tr>
	 	<td  colspan='3' style='font-size:14px;text-transform:uppercase;text-decoration:underline;'>
			<strong>Configuration:</strong>
		</td>
	</tr>
	<tr>
		<td>
			<table id='printfloat' style=''>
				<tr>
					<td colspan='1'>".str_replace("images/price_config/",$SITE_URL."images/price_config/",$pstructure)."</td>
				</tr>
			</table>
		</td>
	</tr>";
	 }

No I wasn’t talking about improperly nesting tables. Probably closer to this based on what I see.

<?php     
    $select_pstructure="select * from pstructure where pid=$id";     
    $result_pstructure=mysql_query($select_pstructure);

    $pstructure = '';
    $pstructure .= "<table>
    <tr>
         <td colspan='2' style='font-size:14px;text-transform:uppercase;text-decoration:underline;'>
            <strong>Configuration:</strong>
        </td>
    </tr>\r";
    $cnt=0;
    while($row_pstructure=mysql_fetch_array($result_pstructure))
    {
        if($cnt % 2 == 0){
            $pstructure .= "<tr>\r";
            $pstructure .= "<td>".str_replace("images/price_config/",$SITE_URL."images/price_config/",$row_pstructure['image_path2'])."</td>\r";
        }else{
            $pstructure .= "<td>".str_replace("images/price_config/",$SITE_URL."images/price_config/",$row_pstructure['image_path2'])."</td>\r";
            $pstructure .= "</tr>\r";
        }
        $cnt++;
    }
    if($cnt % 2 == 1){
        $pstructure .= "<td>&nbsp;</td>\r";
        $pstructure .= "</tr>\r";
    }    
    $pstructure .= "</table>\r"; 
?>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.