错误显示 - >
致命错误:未捕获错误:在C:\ xampp \ htdocs \ destination.php中调用未定义函数mysqli():18堆栈跟踪:#0 {main}在C:\ xampp \ htdocs \ destination.php中引发第18行
我的代码
<?php
if(isset($_GET['submit']))
{
$name=$_GET["name"];
$age=$_GET["age"];
$userid=$_GET["userid"];
// echo "NAME:".$name."<br> AGE:".$age."<br>USERID:".$userid ;
//echo "saved";
$con = mysql_connect("localhost","root","");
if($con)
{
$db = mysql_select_db("practicedb");
if($db)
{
$result = mysql_query("insert into info values('".$age."','".$name."','".$userid."')");
echo ("inserted successfully");
}
else echo ("could not be inseted");
}
else echo ("could not connect to database");
}
else echo ("could not connect to localhost server");
}
请告诉我如何修复
答案 0 :(得分:0)
尝试mysqli_connect函数如下
$con = mysqli_connect('localhost','root','XXX','XXX');