Posted By

rstandley on 02/01/11


Tagged

mysql php script


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Creatiqfr


PHP & MySQL Connect Script


 / Published in: PHP
 

  1. <?php
  2. // This defines the constants for accessing the database
  3. define('db_user','username');
  4. define('db_password','password');
  5. define('db_host','localhost');
  6. define('db_name','database_name');
  7.  
  8. // Connect to MySQL
  9. $dbc = @mysql_connect (db_host, db_user, db_password) OR die ('Could not connect to MySQL: ' . mysql_error() );
  10. // Select the correct databse
  11. mysql_select_db (db_name) OR die ('Could not select the database: ' . mysql_error() );
  12.  
  13. ?>

Report this snippet  

You need to login to post a comment.