mysql data not displaying in table format

daniel

I want to display mysql database data in table format using php. my code is not working. I have data in table and connection is also made. However only the column title gets displayed, and not the database data.

<html>  
<body> 
<table style="width:300px"> 
<tr> <td>Empno</td> <td>Ename</td> <td>address</td> <td>City</td> </tr> 

<?php include("conn.php"); 
$res=mysql_query("select * from info"); 
$res=mysql_query($res); 
$i=1; 
while($row=mysql_fetch_array($res)) { ?> 
<tr> <td><?php echo ($row['empno']);?></td> 
<td><?php echo ($row['ename']);?></td> 
<td><?php echo ($row['address']);?></td> 
<td><?php echo ($row['city']);?></td> </tr> 
<?php $i++; } ?> </table> 
</body> 
</html>
Rakesh Shetty

From your code you are executing two time query :

$res=mysql_query("select * from info"); 
$res=mysql_query($res); // <------ Remove this code

Also what is your file name extension ? It should be .php as you have tag html in your question. If it is in .html change it to .php

On side note don't use mysql_* function since it deprecated see more here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Displaying data in table format from mysql database with php loop

From Dev

Date format from MySQL on table displaying incorrectly

From Dev

Displaying stored column data in table format

From Dev

ng-repeat not displaying the data in table format

From Dev

ChartJS - format datetime X axis when displaying data from MySql table

From Dev

Displaying data in horizontal format

From Dev

Displaying data in horizontal format

From Dev

PHP MYSQL Displaying the same data from table to another page

From Dev

Displaying pivot table data

From Dev

Displaying xml data in a table

From Dev

Format data to table format

From Dev

Date from mysql database is not displaying in html table using the date_format() function

From Dev

Displaying MySQL results in a single table

From Dev

Displaying the content of mysql in bootstrap table

From Dev

Accessing and displaying pivot table data

From Dev

Displaying retrieve data in different table

From Dev

Displaying Data in a Table Android Development?

From Dev

Displaying Data in a Table Android Development?

From Dev

Displaying retrieve data in different table

From Dev

SQLite table not displaying data on activity

From Dev

Displaying data from mysql database

From Dev

Displaying the mysql result in different format using php

From Dev

Display data from mysql query in table format php

From Dev

Joining two tables in PHP/MySQL and displaying elements from both when data from one table is null and the other table's data is not

From Dev

i want to retrieve data from MySQL db by displaying it using table, arrange it the same way it appear in the image

From Dev

Displaying field data of mysql table with selecting field name from the drop down list

From Dev

MySql table into JSON format

From Dev

Format data as a table in bash

From Dev

Format JSON data to table

Related Related

  1. 1

    Displaying data in table format from mysql database with php loop

  2. 2

    Date format from MySQL on table displaying incorrectly

  3. 3

    Displaying stored column data in table format

  4. 4

    ng-repeat not displaying the data in table format

  5. 5

    ChartJS - format datetime X axis when displaying data from MySql table

  6. 6

    Displaying data in horizontal format

  7. 7

    Displaying data in horizontal format

  8. 8

    PHP MYSQL Displaying the same data from table to another page

  9. 9

    Displaying pivot table data

  10. 10

    Displaying xml data in a table

  11. 11

    Format data to table format

  12. 12

    Date from mysql database is not displaying in html table using the date_format() function

  13. 13

    Displaying MySQL results in a single table

  14. 14

    Displaying the content of mysql in bootstrap table

  15. 15

    Accessing and displaying pivot table data

  16. 16

    Displaying retrieve data in different table

  17. 17

    Displaying Data in a Table Android Development?

  18. 18

    Displaying Data in a Table Android Development?

  19. 19

    Displaying retrieve data in different table

  20. 20

    SQLite table not displaying data on activity

  21. 21

    Displaying data from mysql database

  22. 22

    Displaying the mysql result in different format using php

  23. 23

    Display data from mysql query in table format php

  24. 24

    Joining two tables in PHP/MySQL and displaying elements from both when data from one table is null and the other table's data is not

  25. 25

    i want to retrieve data from MySQL db by displaying it using table, arrange it the same way it appear in the image

  26. 26

    Displaying field data of mysql table with selecting field name from the drop down list

  27. 27

    MySql table into JSON format

  28. 28

    Format data as a table in bash

  29. 29

    Format JSON data to table

HotTag

Archive