<?php
$servername = "localhost";
$username = "root";
$password = "123456";
$dbname = "buke";
$conn = mysqli_connect($servername, $username, $password, $dbname);
$sql ="INSERT INTO xuesheng (xingming,nianling,xingbie)
VALUES ('小明','18','男')";
if (mysqli_query($conn, $sql)) {
echo "新记录插入成功";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
when i run it in visule studio 2019 ,I met :
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in D:codenodejshtdocsaddStudent.php:8
Stack trace:
#0 {main}
thrown in D:codenodejshtdocsaddStudent.php on line 8
I have installed
php debug
xdebug
php intelephense
php intellisense
and edit the php.ini:
extension="D:phpstudy_proExtensionsphpphp7.3.4ntsextphp_mysqli.dll"
extension_dir="D:phpstudy_proExtensionsphpphp7.3.4ntsext"