Tuesday, August 27, 2013

Define Connection Variable in php

<?php
  // Define database connection constants
  define('DB_HOST', 'localhost');
  define('DB_USER', 'hemanjosko');
  define('DB_PASSWORD', 'password');
  define('DB_NAME', 'database-name');
?>

connect.php
-------------------------------------

   $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

you may include this to anywhere, where you want to add the connection of php to mysql

No comments:

Post a Comment

What You Think