b*******l 发帖数: 1737 | 1 Hello all,
I am new to PHP and MySQL programming, and I am trying to connect to MySQL
via my PHP script. My PHP scripts generally work. However, for the following
PHP code:
ini_set('display_errors', true);
error_reporting(E_ALL);
$mysqli = mysqli_connect("localhost", "xxx", "xxx", "test");
...................
?>
I get the following error message:
Fatal error: Call to undefined function mysqli_connect() in C:\Program Files
\Apache Group\Apache2\htdocs\simpleconnection.php on line 6
Can some | j*****o 发帖数: 320 | 2 This is PHP5 only. Maybe your host supports PHP4 by default? If so, you
may need a htaccess file to enable PHP5.
Hello all,
I am new to PHP and MySQL programming, and I am trying to connect to MySQL
via my PHP script. My PHP scripts generally work. However, for the following
PHP code:
ini_set('display_errors', true);
error_reporting(E_ALL);
$mysqli = mysqli_connect("localhost", "xxx", "xxx", "test");
...................
?>
I get the following error message:
Fatal error: Call to undefined
【在 b*******l 的大作中提到】 : Hello all, : I am new to PHP and MySQL programming, and I am trying to connect to MySQL : via my PHP script. My PHP scripts generally work. However, for the following : PHP code: : : ini_set('display_errors', true); : error_reporting(E_ALL); : $mysqli = mysqli_connect("localhost", "xxx", "xxx", "test"); : ................... : ?>
| e******x 发帖数: 925 | 3 把php.ini的mysql的extension前面的分号去掉。
following
【在 b*******l 的大作中提到】 : Hello all, : I am new to PHP and MySQL programming, and I am trying to connect to MySQL : via my PHP script. My PHP scripts generally work. However, for the following : PHP code: : : ini_set('display_errors', true); : error_reporting(E_ALL); : $mysqli = mysqli_connect("localhost", "xxx", "xxx", "test"); : ................... : ?>
| b*******l 发帖数: 1737 | 4 Thanks, easywebx. That's it. I was wondering why the default php.ini
commented out all these extensions.
The function is available now. However, I still cannot connect to the
database. Below is my code:
ini_set('display_errors', true);
error_reporting(E_ALL);
$mysqli = new mysqli("localhost", "john", "abc123", "test");
If (1 > 0) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info($mysqli));
mysqli
【在 e******x 的大作中提到】 : 把php.ini的mysql的extension前面的分号去掉。 : : following
| e******x 发帖数: 925 | 5 试试: $mysqli = mysqli_connect("localhost", "john", "abc123", "test");
或者先用root用户试试。
【在 b*******l 的大作中提到】 : Thanks, easywebx. That's it. I was wondering why the default php.ini : commented out all these extensions. : The function is available now. However, I still cannot connect to the : database. Below is my code: : : ini_set('display_errors', true); : error_reporting(E_ALL); : $mysqli = new mysqli("localhost", "john", "abc123", "test"); : If (1 > 0) { : printf("Connect failed: %s\n", mysqli_connect_error());
| l*******9 发帖数: 177 | 6
why do you do this?
【在 b*******l 的大作中提到】 : Thanks, easywebx. That's it. I was wondering why the default php.ini : commented out all these extensions. : The function is available now. However, I still cannot connect to the : database. Below is my code: : : ini_set('display_errors', true); : error_reporting(E_ALL); : $mysqli = new mysqli("localhost", "john", "abc123", "test"); : If (1 > 0) { : printf("Connect failed: %s\n", mysqli_connect_error());
| b*******l 发帖数: 1737 | 7 easywebx,
谢谢。我已经发现我的问题了。
再次多谢。
blackpool
【在 e******x 的大作中提到】 : 试试: $mysqli = mysqli_connect("localhost", "john", "abc123", "test"); : 或者先用root用户试试。
| b*******l 发帖数: 1737 | 8 lihao0129,
哦。这个正是我的问题。我一开始因为像easywebx所说的那样,把extension=mysql给
comment掉了。error message告诉我说那个函数找不着。我就设了一个测试的
statement, 结果发现程序根本运行不过 $mysql = new mysql (....)这句。后来听了
easywebx的,把 php.ini改了,那个函数就找到了。不过我忘了把我的程序该回去了。
stupid. haha. 如果是 if (1>0), 当然是要出那个结果了。
我把程序又改了,现在好使了。
谢谢你。
blackpool
【在 l*******9 的大作中提到】 : : why do you do this?
|
|