PHP的MySQL配置
报错信息:Class \'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.重启服务
连接数据库
//printf() 函数输出格式化的字符串
while(list($name, $theindex) = $result->fetch_row())
echo(\" <br />\".$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 (\"<table border=1>\");
while($row = mysql_fetch_assoc($rs))
{
echo \"<tr>\" .
\"<td>$row[theindex]</td>\" .
\"<td>$row[name]</td>\" .
\"</tr>\";
}
mysql_free_result($rs);
}
echo (\"</table>\");
mysql_close($con);
}
本文地址:https://www.stayed.cn/item/9927
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我