Here we discuss about PHP MySQL Connection. The PHP Programmer usually know about this. There was mysql_connect and mysqli_connect. The function mysql_connect and mysqli_connect actually have same objectives to provide a database connection, but mysqli_connect is newer version of mysql_connect.
So here is the code :
<?php
$hostname = "localhost";
$username = "root";
$password = "picas";
$database = "mydb";
$conn = mysql_connect($hostname, $username, $password)
or die("Connection fail ...");
mysql_select_db($database, $conn);
?>
mysqli_connect have shorter code than mysql_connect, and not using
<?php
$link = mysqli_connect (localhost, root, picas, mydb);
?>
Themysql_select_db.
Tidak ada komentar:
Posting Komentar