PHP的MysqL配置
MysqLi' not found in
Answer:
1.在conf/PHP.ini中,在vim用"/PHP_MysqL"搜索到extension=PHP_MysqL.dll,去掉前面的";",
同时在下面增加extension=PHP_MysqLi.dll;
注意后面那个dll多了个i
2."/extension_dir"检查路径是否正确;
3.找到ext/目录,把其中的PHP_MysqL.dll,PHP_MysqLi.dll两个文件Copy to %systemroot%/system32下.
4.重启服务
连接数据库
代码如下:
//在conf/PHP.ini中,同时在下面增加extension=PHP_MysqLi.dll;
$MysqLi = new MysqLi("127.0.0.1","用户名",密码","库名");
$query="select * from 表 order by theindex desc";
$MysqLi->query("SET NAMES gb2312");//注意此处不加会乱码
$result = $MysqLi->query($query);");
MysqL_close($con);
}
$MysqLi = new MysqLi("127.0.0.1","用户名",密码","库名");
$query="select * from 表 order by theindex desc";
$MysqLi->query("SET NAMES gb2312");//注意此处不加会乱码
$result = $MysqLi->query($query);
//printf() 函数输出格式化的字符串
while(list($name,$theindex) = $result->fetch_row())
echo("
".$name.$theindex);
$con = MysqL_connect("localhost","密码");
if ($con) {
MysqL_query("set names 'gb2312'");
MysqL_select_db("库名",$con);//注意此处不加会乱码
$rs = MysqL_query("select * from 表 order by theindex desc;",$con);
if ($rs) {
echo ("
" | " |
}