jollyfactory
02-10-2003, 03:59 AM
Just wondering if this is possible. First I have this code
<?php
mysql_connect("localhost","root","**");
//get all main page categories
$sql = mysql_query("SELECT * FROM table");
?>
<table border=1 width=100%>
<?
while ($row = mysql_fetch_array($sql)) {
//place items into variables
$title = $row['title'];
$description = $row['description'];
?>
<tr><td><?echo($title);?></td></tr>
<tr><td><?echo($description);?></td></tr>
<tr><td>=========================</td></tr>
<?
}
?>
</table>
As you can see, it will keep looping through and printing a new table row until the array left in $row is empty.
The link below is how it would sort of output the array
http://resma.net/example1.html
And this is how I want it to look
http://resma.net/example.html
As you can see, the output is the same, its just that each output of the loop is placed in a one of two cells. Just wondering how I could achieve this.
Any help is appreciated.
If you need more clarification, just ask :) and I'll try to be more clearer.
Thanks :)
<?php
mysql_connect("localhost","root","**");
//get all main page categories
$sql = mysql_query("SELECT * FROM table");
?>
<table border=1 width=100%>
<?
while ($row = mysql_fetch_array($sql)) {
//place items into variables
$title = $row['title'];
$description = $row['description'];
?>
<tr><td><?echo($title);?></td></tr>
<tr><td><?echo($description);?></td></tr>
<tr><td>=========================</td></tr>
<?
}
?>
</table>
As you can see, it will keep looping through and printing a new table row until the array left in $row is empty.
The link below is how it would sort of output the array
http://resma.net/example1.html
And this is how I want it to look
http://resma.net/example.html
As you can see, the output is the same, its just that each output of the loop is placed in a one of two cells. Just wondering how I could achieve this.
Any help is appreciated.
If you need more clarification, just ask :) and I'll try to be more clearer.
Thanks :)