Hi,
I have created a database on a website using phpmyadmin and I would like to display the result of a mySQL query on a webpage using PHP.
I used the following code and nothing appears on my webpage:
Can anyone help me fix this, please ?
I have created a database on a website using phpmyadmin and I would like to display the result of a mySQL query on a webpage using PHP.
I used the following code and nothing appears on my webpage:
Code:
<?php // mySQL database connection $con = mysql_connect("db_server", "username", "password"); if (!$con) { die ('Could not connect: ' . mysql_error()); } mysql_select_db("db_name", $con); $query = 'SELECT * FROM person'; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)); { echo $row['name']; echo $row['surname']; echo $row['country']; } ?>
Comment