mysql connect php
# MySql improved
<?php
$mysqli = new mysqli("localhost", "username", "password", "dbname");
$result = $mysqli->query("SELECT lastname FROM employees");
?>
# Connection with PDO
<?php
$myPDO = new PDO('mysql:host=localhost;dbname=dbname', 'username', 'password');
$result = $myPDO->query("SELECT lastname FROM employees");
?>
# With PHP legacy functions:
<?php
mysql_connect('localhost','username','password');
mysql_select_db("dbname");
$result = mysql_query('SELECT lastname FROM employees');
?>