QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 673|回复: 4

php不能打开MYSQL;PHP-MYSQL已安装,

[复制链接]
发表于 2003-4-5 18:52:59 | 显示全部楼层 |阅读模式
php不能打开MYSQL;PHP-MYSQL已安装,如何解决:

我的mysql运行如下:(mysql已设定了用户denguo)
[root@localhost root]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.49

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> Use dase1
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from my1;
+--------+------------+
| name   | phone      |
+--------+------------+
| denguo | 5346727    |
| den    | 1319201085 |
+--------+------------+
2 rows in set (0.03 sec)

mysql>

Fatal error: Call to undefined function: mysql_connect() in /var/www/html/denguo/05.php on line 7
源码如下:
<html>
<head><title>Web Database Sample Index</title>
</head>
<body bgcolor=#ffffff>
&lt;h1&gt;Data from mytable&lt;/h1&gt;
&lt;?php
$connect=mysql_connect('localhost','denguo','');
$select = mysql_select_db('dase1',$connect);
$result = mysql_query("select * from my1", $connect);
if ($result) {
echo "Found these entries in the database:<ul>";
while ($r = mysql_fetch_array($result)) {
$name = $r["name"];
$phone = $r["phone"];
echo "&lt;li&gt;$name, $phone";
}
echo "</ul>";
}
else{
echo "No data.";
}
mysql_free_result($result);
?&gt;

&lt;p&gt;&lt;a href="add.php3"&gt;Add new entry&lt;/a&gt;
</body>
&lt;/html&gt;
发表于 2003-4-8 00:34:36 | 显示全部楼层
ok, you have mysql installed, php + apache installed, but we don't know if you have compiled php with mysql! so, try to use this to check your compilation's option

&lt;?php
phpinfo();
?&gt;
回复

使用道具 举报

发表于 2003-4-20 21:21:25 | 显示全部楼层
一种可能是看你是不是有密码
二来就是
$result = mysql_query("select * from my1", $connect);
改成
$result = mysql_query("select * from my1", $select);
i think
回复

使用道具 举报

发表于 2003-4-20 21:21:55 | 显示全部楼层
一种可能是看你是不是有密码
二来就是
$result = mysql_query("select * from my1", $connect);
改成
$result = mysql_query("select * from my1", $select);
i think
回复

使用道具 举报

发表于 2003-4-21 07:00:31 | 显示全部楼层
"undefined function" means either he don't included "--with-mysql" options when he build the  php with apache, or some errors with his php's path (check with /usr/lib/php.ini?? I'm not sure  anymore for this).

He don't even got run mysql_connect, mysql_select will not run either!.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-16 02:58 , Processed in 0.043466 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表