PHP source codes for accessing the MySQL database

Here is an example of PHP code

<?

   // Replace the values of the $db_server, $db_database, $db_uid, $db_pwd
   // with the respective values on your control panel: server, database, username, password

   $db_server = "127.0.0.1" ;
   $db_database = "m1d1" ;
   $db_uid = "m1d1" ;
   $db_pw = "ue72agsx61qasw91" ;

   // Connect to database
   $link = mysql_connect($db_server,$db_uid,$db_pw);
   mysql_select_db($db_database);

   $result=mysql_query("SELECT name FROM users",$link);
   if ($result)
   {
      while ($row = mysql_fetch_object($result))
      {
         echo ("$row->name<br />");
      }
   }

   mysql_free_result($result);

?>

back