Posted By

inky76 on 12/22/10


Tagged

mysql php


Versions (?)

Creating PHP Connection to MySQL Table


 / Published in: PHP
 

  1.  
  2. <?php
  3.  
  4. $connection = mysql_connection('localhost','username','password');
  5. // three parameters (server connection, username, password
  6.  
  7. //testing connection
  8. //concatenates the mysql_error() call to the string
  9. if(!$connection){
  10. die('error connection to database server'.mysql_error());
  11. }
  12. //checks to see if connected to proper database
  13. if(!mysql_select_db('database_name',)){
  14. die('error connection to database');
  15. }
  16.  
  17. ?>
  18.  
  19.  
  20.  

Report this snippet  

You need to login to post a comment.