码迷,mamicode.com
首页 > Web开发 > 详细

新版本PHP使用更方便了

时间:2015-09-05 23:30:53      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

$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);
?>

新版本PHP使用更方便了

标签:

原文地址:http://www.cnblogs.com/chenjian/p/4784068.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!