View Single Post
  #1 (permalink)  
Old 05-25-09, 04:09 AM
kavionly kavionly is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with displaying data

Hi, i have a product name which is common for all product type.I have some problem with formatting, can anyone help me to solve this problem

Here is my HTML mock up

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="620" border="1">
  <tr>
    <td width="130">Product Name </td>
    <td width="143">Product Type</td>
   
  </tr>
  <tr>
    <td>Coated </td>
        <td>Silk</td>
  </tr>
  <tr>
    <td></td>
   
    <td>Gloss </td>
  </tr>
  <tr>
    <td></td>
    <td>Cast Coated </td>
  </tr>
  <tr>
    <td></td>
    <td>Matt </td>
  </tr>
  <tr>
    <td></td>
    <td> Part Mechanical </td>
  </tr>
  <tr>
    <td></td>
    <td> Gloss Digital </td>
  </tr>
  <tr>
    <td></td>
    <td> Silk Digital </td>
  </tr>
  <tr>
    <td></td>
    <td> Gloss One Sided </td>
  </tr>
</table>
</body>
</html>
Here is my code

PHP Code:

<?php
include "config.php";

$query"select jos_list.*,jos_list_categories.title as maincat from jos_list,jos_list_categories  where  jos_list.category_id=jos_list_categories.id and jos_list_categories.id='43'"

$result mysql_query($query);

echo 
"<table border=\"1\" align=\"center\">";
echo 
"<tr><th>Product Name</th>";
echo 
"<th>Produt Type</th></tr>";
while (
$row mysql_fetch_array($result))
{
    
$cat[$row['maincat']] = $row['maincat'] ;
  
    echo 
"<tr>";
    foreach(
$cat as $kk=>$vv)
     {
    echo 
'<td>'.$kk.'</td>';
    }
    echo 
"</td><td>";
    echo 
$row['title'];
    echo 
"</td></tr>";
}
echo 
"</table>";
?>

Last edited by kavionly; 05-25-09 at 04:36 AM.
Reply With Quote