MySQL DB Connect


/ Published in: PHP
Save to your folder(s)

Use to connect to MySQL db. Use in a 'db_connect.inc' type file.


Copy this code and paste it in your HTML
  1. $host = localhost;
  2. $usr = 'user';
  3. $pwd = 'pass';
  4.  
  5. #connect to database
  6. $cid = mysql_connect($host,$usr,$pwd);
  7. if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.