This code shows you how to display your mysql data horizontal. The code display 4 products across with two rows, so i display 8 products in total.    <?php    // fetch data. I am only going to display 8 products.    // calculate table dimensions. This will display 4 products in a line and then another 4 on the next line. //I have a bike details page that i’m going to link to. I am also diplaying the bike image. The images are held in folder called ProductImages.                  $item1 = “<td width=’160′><br><a href=’UsedBikeDetails.php?BikeID=$BikeID’><img border=’0′ src=’ProductImages/$BikeID.jpg’ width=’150′ height=’200′></a><br><font color=’#CA0202′>Model:</font> $band<br><font color=’#CA0202′>Make:</font> $album <br><font color=’#CA0202′>Price:</font> $Price<br><font color=’#CA0202′>Product ID:</font> $BikeID</td>”;             echo “\n\t\t<td>$item1</td>”; Hope this helps from Software Development Company
   // connect to mysql database server
include ‘config.php’;
include ‘opendb.php’;
   $res = mysql_query(“SELECT * FROM usedbikes where Publish = ‘Y’ order by BikeID desc LIMIT 8″);
   $num = mysql_num_rows($res) ;
//If you wanted to display more products change the Limit 8 to Limit 12.
    $per_row = 4;
   $rows = (int) (($num + $per_row – 1) / $per_row);
   $count = 0;
Â
   //Create Html table
    echo “\n<table>”;
   for ($i = 0; $i < $rows; $i++)
   {
       echo “\n\t<tr>”;
       for ($j = 0; $j < $per_row; $j++)
       {
           if ($count < $num)
           {
               $it = mysql_fetch_array($res);
               $Model= $it["Model"];
               $Make= $it["Make"];
               $Price= $it["Price"];
                    }
           else
Â
               $item1 = “”;
           $count++;
           Â
       }
       echo “\n\t</tr>”;
   }
   echo “</table>”;
?>
The below code connects to a mysql database. <?php //All the below variables are related to your mysql database //connection to the database //select a database to work with //execute the SQL query and return records //fetch tha data from the database Don’t forget to create your mysql database and table.
$username = “your_name”;
$password = “your_password”;
$hostname = “localhost”;Â
$dbhandle = mysql_connect($hostname, $username, $password)
 or die(“Unable to connect to MySQL Database”);
echo “Connected to MySQL Database<br>”;
$selected = mysql_select_db(“DatabaseName”,$dbhandle)
 or die(“Could not select DatabaseName “);
$result = mysql_query(“SELECT id, model,year FROM cars”);
while ($row = mysql_fetch_array($result)) {
  echo “ID:”.$row{‘id’}.” Name:”.$row{‘model’}.”Year: “. //display the results
  $row{‘year’}.”<br>”;
}
//close the connection
mysql_close($dbhandle);
?>



