How to select and display MySQL records data in PHP
This is the simplest code to select and display records from MySQL database table and display in PHP.
$cn=mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
mysql_select_db($db_name,$cn) or die(mysql_error());
mysql_select_db($db_name,$cn) or die(mysql_error());
$sql = “SELECT field_name FROM table_name”;
$rs = mysql_query($sql) or die(mysql_error());
$rs = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($rs)){
echo $field_name = $row["field_name"];
echo “</br>”;
echo “</br>”;
}mysql_free_result($rs);
No comments:
Post a Comment