Prakash N
Prakash N

Reputation: 220

create table in html as per the condition given for a table to mysql database table

I want to create a table(in HTML) which will display rows and columns where i am calling from my query statement i.e.,

select id,name,city from contacts where enquiry_id=125

which will display 3 to 4 rows of data having enquiry_id=125.

The result will be displayed in HTML format for PHP.(or HTML)..

Upvotes: 1

Views: 340

Answers (1)

Humphrey
Humphrey

Reputation: 2817

You can try this and do not forget to connect to the database:

while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {
    ?>

<tr>
    <td><?=$record['id']; ?></td>
    <td><?=$record['name']; ?></td>
      <td><?=$record['city']; ?></td>
</tr>    
<?
}

mysql_free_result($result);
?>
</table>

Upvotes: 1

Related Questions