php配置Mysql后测试报 Call to undefined function mysql_connect()....
windows下配置,在用phpinfo()能显示mysqli,但是在用mysql_connect就会报错UncaughtError:Calltoundefinedfun...
windows下配置,在用phpinfo()能显示mysqli,但是在用mysql_connect就会报错 Uncaught Error: Call to undefined function mysql_connect() in D:\LAMP\Apache24\htdocs\first.php:14 Stack trace: #0 {main} thrown in D:\LAMP\Apache24\htdocs\first.php on line 14
展开
展开全部
#mysqli的简单用法
<?php
$dbhost ="127.0.0.1";
$dbuser = "root";
$dbpwd = "123456";
$dbname = "test";
$charName = "'UTF8'"; //设置查询字符集gbk,gbk2312,utf-8
$mysqli = new mysqli($dbhost,$dbuser,$dbpwd,$dbname);
if (mysqli_connect_errno()){ //注意mysqli_connect_error()新特性
die('Unable to connect!'). mysqli_connect_error();
}
$sql = "SET NAMES ".$charName;
$mysqli->query($sql);
//$mysqli->query("SET NAMES 'UTF8'");
?>
用mysqli 就不在使用mysql_connect了 高版本 使用mysql_connect 会出警告的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询