由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
BuildingWeb版 - error in connecting PHP with MySQL
相关主题
Apache PHP 和MySQL 的版本问题Question about Apache & permission
请推荐好的web hosting service,要求如下:How To Install Linux, Apache, MySQL, PHP (LAMP)
请问php+mysql查询结果为什么总被保存?[合集] 请问 在windows Xp 上怎么装 phpbb
PHP mysqli的too many connections的问题PHP question. Please help
PHP: Mysql 得parse 问题What do I need to install Joomla?
新浪互联星空网站的体系结构(转)quesiton about PHP! waiting online
有成功集合过Apache2和PHP4的大侠吗?Apache 1.3.33 + PHP 4.3.10 @ Redhat 9???
Can not start Apache 2 with 用户认证. :-(要能用index.php就好了!
相关话题的讨论汇总
话题: php话题: mysqli话题: mysql话题: error话题: connect
进入BuildingWeb版参与讨论
1 (共1页)
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?

1 (共1页)
进入BuildingWeb版参与讨论
相关主题
要能用index.php就好了!PHP: Mysql 得parse 问题
PHP 的有关问题‘新浪互联星空网站的体系结构(转)
新手问3个apache、php的问题有成功集合过Apache2和PHP4的大侠吗?
请推荐PHP MVC的框架Can not start Apache 2 with 用户认证. :-(
Apache PHP 和MySQL 的版本问题Question about Apache & permission
请推荐好的web hosting service,要求如下:How To Install Linux, Apache, MySQL, PHP (LAMP)
请问php+mysql查询结果为什么总被保存?[合集] 请问 在windows Xp 上怎么装 phpbb
PHP mysqli的too many connections的问题PHP question. Please help
相关话题的讨论汇总
话题: php话题: mysqli话题: mysql话题: error话题: connect