I have a script that displays data from Mysql server, what i hoping to do is display the data in a HTML Table.

I would like to create the table in deamweaver purley cause i am not great at HTML.

<table width="65%" height="404" border="1" align="left" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="16" colspan="2" valign="top"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Product 
        Name </font></div></td>
  </tr>
  <tr> 
    <td width="21%" height="109"><div align="justify">Picture</div></td>
    <td width="79%" rowspan="2">Product Info</td>
  </tr>
  <tr> 
    <td height="98"><p>Add To Cart Link</p>

How can i put the data in the cells?

Thanks in advance

<? $query = //your query ?>
-- then your table
<table>
and loop
<? while ($row=mysql_fetch_array($query)) { ?>
<tr>
      <td height="16" colspan="2" valign="top"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?=$row['ProductName'];?></font></div></td>
  </tr>
  <tr> 
    <td width="21%" height="109"><div align="justify"><?=$row['Picture'];?></div></td>
    <td width="79%" rowspan="2"><?=$row['Product Info'];?></td>
  </tr>
  <tr> 
    <td height="98" colspan=2><p>Add To Cart Link</p>
</td>
</tr>
<? } //end of loop ?>
</table>

hope this helps...

Just Tried the code:

<? $query = "select * from Prod_listing"; ?>

<table width="42%">

<? while ($row=mysql_fetch_array($query)) { ?>
<tr>
<td height="16" colspan="2" valign="top"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
        <?php $row["Product_Name"];?>  
         <?php $row["Product_Id"] ;?></font></div></td>
</tr>
<tr>
<td width="21%" height="109"><div align="justify"><?php $row["Product_picurl"];?></div></td>
<td width="79%" rowspan="2"><?php $row["Product_Description"];?></td>
</tr>
<tr>
<td height="98" colspan=2><p>Add To Cart Link</p>
</td>
</tr>
<? } //end of loop ?>
</table>

No data is displayed

I Im still not getting any joy!!!

when i change a database field to a name not present in the database i get the html table.

No PHP errors are shown, i dont even think the script is even connecting to the database..

<?php
//--------------- Connection Script ----------------------------\\
$username = "********";
$password = "********";
$hostname = "********"; 
$dbh = mysql_connect($hostname, $username, $password) 
     or die("Unable to connect to MySQL");
//------------------- Select Database --------------------------\\  
    $selected = mysql_select_db("dutty_dp",$dbh) 
    or die("Could not select first_test");
?>
</head>

<body>
<?
 $query = "SELECT `Product_picurl`, `Product_Name`, `Product_Description`, `Product_price`, `Product_Category`, `Product_Pdf`, 
 `Product_Cart`, `Product_Features`, `Product_subcat`, `Key` FROM `prod_listing` where `Product_subcat` = 'Absorption Panels'"; ?>

<table width="42%" cellpadding="1" cellspacing="0">

<? while ($row=mysql_fetch_array($query)) { ?>
<tr>
<td height="16" colspan="2" valign="top"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
        <?php echo $row["Product_Name"];?> / Product ID <?php echo $row["Product_Id"] ;?></font></div></td>
</tr>
<tr>
<td width="19%" height="108"><div align="justify"><?php echo $row["Product_picurl"];?> 
        <p align="center"> £<?php echo $row["Product_price"];?></div></td>
<td width="81%" valign="top"><?php echo $row["Product_Description"];?></td>
</tr>
<tr>
<td height="25" colspan=2><p align="center"><a href="#">Add to Cart</a></p>
</td>
</tr>
<? } //end of loop ?>
</table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.