1.造一个mysqli对象,造连接对象
$db = new MySQLi("localhost","root","123","mydb");
2.准备一条SQL语句
$sql = "select * from info";
3.执行SQL语句,如果是查询语句,成功返回结果集对象
$reslut = $db->query($sql);
4.判断返回是否执行成功
if($reslut)
{
echo "执行成功";
}
else
{
echo "执行失败";
}
1.造一个mysqli对象,造连接对象
$db = new MySQLi("localhost","root","123","mydb");
2.准备一条SQL语句
$sql = "select * from info";
3.执行SQL语句,如果是查询语句,成功返回结果集对象
$reslut = $db->query($sql);
4.判断返回是否执行成功
if($reslut)
{
echo "执行成功";
}
else
{
echo "执行失败";
}