Posted By

zubacris on 03/29/11


Tagged

mysql db textmate connect connecttodb


Versions (?)

connect to db


 / Published in: Other
 

  1. <?php
  2. require("constants.php");
  3.  
  4. //create database connection
  5. $conn = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
  6. if(!$conn) {
  7. die("Database connection failed: ". mysql_error());
  8. }
  9.  
  10. // Selecting a database to use
  11. $db_select = mysql_select_db(DB_NAME, $conn);
  12. if(!$db_select) {
  13. die("Database selection failed: " . mysql_error());
  14. }
  15. ?>
  16.  
  17.  

Report this snippet  

You need to login to post a comment.