Jump to content

[SOLVED] query return in columns...


AV1611

Recommended Posts

[code]<?
// query db and get results.... loop through them and add to an array

$result_array[]="results from database"
$x=0;    // set a counter to 0
?>

<table  >

<?
while($x < count($result_array)){
?> 
<tr>  <td> <?=$result_array[$x++] ?>  </td>  <td><?=$result_array[$x++] ?></td>  </tr> 

?>

</table>[/code]


This will produce a 2 column table for the results being displayed.
I was pretty happy that I came up with that bit of code myself. Its expandable too, just copy/paste the <td>......</td> and it gives you another column

The other examples are too damn lengthy for me. I see no need to run for loops and calculate what freaking column we are on and all that jazz.....this is simple and to the point.


enjoy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.