PHP with MySQL-Create mysql connection in php
To connect php with mysql, we need a code to connect.
follow the tutorial below:
- create a file "connect.php"
- edit script:
- save and run.
- success.
<?php
$host="server";
$user = "username"; $pass = "password"; $dbname = "dbname"; $conn = mysql_connect ($host, $user, $pass); if ($conn) { $conect = mysql_select_db ($dbname); if (!$conect) { die ("can't open database!"); } } else { die ("Can't connect to server"); }
?>
thank you for this blog visit home
kitprogrammer
Comments
Post a Comment