single page
php – displaying mysql data horizontal
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>”;
?>




this post is very usefull thx!