Posted by Richard Lynch on 09/26/12 11:14
On Tue, April 26, 2005 3:11 am, Amir Mohammad Saied said:
> i want to extract the data from my DB (it's an articles database) and
> want to show them in 2 columns way, like zend.com's articles section,
> could any one help me?
Do you want them in column order or row order?
(left-right or up-down)
$row = 0;
echo "<table>\n";
while (list(...) = mysql_fetch_row(...)){
if (($row % 2) == 0){
echo "<tr><td>...</td>";
}
else{
echo "<td>...</td></tr>\n";
}
$row++;
}
echo "</table>\n";
OR
$row = 0;
$num_rows = mysql_num_rows(...);
$cutoff = ceil($num_rows/2);
echo "<table><tr valign='top'><td>\n";
while (list(...) = mysql_fetch_row(...)){
echo "...<br />\n";
if ($row == $cutoff){
echo "</td><td>\n";
}
}
echo "</td></tr></table>\n";
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|