Wednesday 20 February 2013

Filled Under:

Start connection php to mysql database

Start connection php to mysql database.

<?php
$con = mysql_connect("localhost","peter","abc123"); // by default password of localhost is "".
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// some code
?>

closing connection


<?php
$con = mysql_connect("localhost","peter","abc123"); // by default password of localhost is "".
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// some code
?>

 





2 comments: