Displaying Data from MySql Database Table in PHP

Selecting and Displaying Data from MySql database table in php:
<?php
$con = mysql_connect(“localhost”,”peter”,”abc123″);
if (!$con)
  {
  die(‘Could not connect: ‘ . mysql_error());
  }
mysql_select_db(“db_name”, $con);
$result = mysql_query(“SELECT * FROM Persons”);
while($row = mysql_fetch_array($result))
  {
  echo $row[‘FirstName’] . ” ” . $row[‘LastName’];
  echo “<br />”;
  }
mysql_close($con);
?>

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Leave a Reply

Your email address will not be published. Required fields are marked *