hi i want to create table in php but i dont know how many row are in database. but i want to show 2 records per row. please help me how can i do that ??
here is my code but it wasnt work as i desired it create i column not 2.
<?php
require_once("config.inc");
function getBookSeller ()
{
$con = mysql_connect(server , userName , password ) or die('DataBase cannot connect. Reason: ' . mysql_errno());
mysql_select_db(db_name) or die('Table cannot connect. ' . mysql_errno());
$sql = "SELECT *
FROM book_sellers";
$result = mysql_query($sql, $con) or die('Query Error. ' . mysql_errno());
$totalrows = mysql_affected_rows();
$totalrows = ceil( $totalrows/2);
//echo $totalrows;
echo "<table width='600' border='1' cellspacing='2' cellpadding='3' bordercolor='#FFFFFF'>";
echo "<tr align='center'>";
echo "<td colspan='2' bordercolor='#000000' bgcolor='#9999CC'><b>Get
your copy today</b></td>";
echo "</tr>";
while($row = mysql_fetch_array($result))
{
$output = "<tr bordercolor='#CCCCCC'>";
$output .= "<td> <b>".$row["book_shop"]."</b><br><br>";
$output .= "<b>Att: </b>".$row["name"]."<br>";
$output .= "<b>Add: </b>".$row["address"]."<br>";
$output .= "<b>Phone: </b>".$row["ph"]."<br>";
$output .= "<b>Fax: </b>".$row["fax"]."<br>";
$output .= "<b>Mobile: </b>".$row["mobile"]."<br>";
$output .= "<b>Email: </b>".$row["email"]."<br>";
$output .= "<b>Website: </b>".$row["website"]."<br>";
$output .= "</td>";
$output .= "</tr>";
echo $output;
}
echo "</table>";
}
?>