找不到类"mysqli_connect" [英] Class 'mysqli_connect' not found
本文介绍了找不到类"mysqli_connect"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,这是我现在的问题.我正在使用PHP 5.5.12和MySQL 5.6.17.在我的PHP设置中检查了php mysqli_connect,但仍然出现错误.有帮助吗?预先感谢.
Okay so this is my problem now. I am using PHP 5.5.12 and MySQL 5.6.17. The php mysqli_connect is checked on my php settings but still getting error. ANy help? Thanks in advance.
这是我的dbcon.php
Here is my dbcon.php
<?php
//Connect to the database
$link = new mysqli_connect ("localhost", "root", "", "towertec_master");
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}?>
这是我的main.php
And this is my main.php
<?php
include ("lib\dbcon.php");
// is a client logged in?
include("lib/login_check.php");
include("lib/fetch_org_data.php");
$thispage="main";
?>
这是错误消息:
Fatal error: Class 'mysqli_connect' not found in C:\wamp\www\Trading\lib\dbcon.php on line 3
Call Stack
# Time Memory Function Location
1 0.0014 244472 {main}( ) ..\main.php:0
2 0.0023 247912 include( 'C:\wamp\www\Trading\lib\dbcon.php' ) ..\main.php:2
推荐答案
mysqli_connect
是一个函数,而不是一类.您想要的是:
mysqli_connect
is a function, not a class. What you want is either:
$link = mysqli_connect(...);
或
$link = new mysqli(...);
两者都是等效的.
这篇关于找不到类"mysqli_connect"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文