0 down vote favorite
I have a table in database like this:
ID, features, Values : ID will be 1, 2, 3.... features will be color, size, material.... values will be red, 13inch, silicon...
I stored it like this:
ID
1
1
1
Features
color
size
material
values
red
13in
silicon
and it continues for product 2... . I am trying to display it in tabular form which i am not getting.
Actually it has to go to next row when id -2 comes... but it keeps on displaying in the same row....
can somebody tell me how to do it?
I tried like this
if(isset($_POST['submit']))
{
$id = $_POST['id'];
$test = "SELECT id, features, values FROM mytable WHERE features IN ('color', 'size', 'material') AND id IN (" . implode(',',$id) .")";
$result = mysql_query($test) or die (mysql_error());
echo "<table width='100%'>";
echo "<tr><th>color</th>
<th>size</th>
<th>material</th></tr>";
echo "<tr>";
while ($row = mysql_fetch_assoc($result)) {
echo "<td>".$row['values']."</td>";
}
echo "</tr>";
echo "</table>";
}
and it continues for product 2... . I am trying to display it in tabular form which i am not getting.
Actually it has to go to next row when id -2 comes... but it keeps on displaying in the same row....
can somebody tell me how to do it?