标签:
$hostname_conn = "";
$database_conn = "";
$username_conn = "root";
$password_conn = "";
$conn =mysqli_connect($hostname_conn, $username_conn, $password_conn, $database_conn);
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
mysqli_query($con,"SELECT * FROM Persons");
mysqli_query($con,"INSERT INTO Persons (FirstName,LastName,Age)
VALUES (‘Glenn‘,‘Quagmire‘,33)");
mysqli_close($con);
?>
标签:
原文地址:http://www.cnblogs.com/chenjian/p/4784068.html