Perform queries against the database in PHP
Description
The following code shows how to perform queries against the database.
Example
// w w w . j ava 2 s .c om
<?php
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
mysqli_query($con,"SELECT * FROM employee");
mysqli_query($con,"INSERT INTO employee (Name) VALUES ('NewName')");
mysqli_close($con);
?>