How to make connection with mysql
$host="localhost"; \\ if the database you want to interact is on your pc.
$user="root"; \\ mysql username, by default is root
$pass="yourpassword"; \\ pass of mysql, if there is no password then $pass="";
$db_name="yourdatabase";
mysql_connect("$host","$user","$pass") or die("cannot connect to the database server");
mysql_select_db("$db_name") or die("cannot select the database");
save this in any file, such as conn.php and include in every file over which u want database interaction.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment