首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >数据库连接问题

数据库连接问题
EN

Stack Overflow用户
提问于 2011-06-27 09:50:56
回答 2查看 240关注 0票数 1

我只是一个初学者,只是尝试从一个db.there读取数据是2个文件,一个是包含db连接代码的文件,另一个是我给出的code.In db的第二部分,在这里有3列: 1.id、2.name和3.说明当我试图打开火狐中的定位文件夹时

“致命错误:调用C:\xampp\htdocs\www\ connection\index.php中的未定义函数connection\index.php()”

8 num线是

同时($person=mysql_fetch_arrey($result))

我被选中"mysql_fetch_arrey($result)“和"$mysql_fetch_arrey($result)”

但这表明

“致命错误:函数名必须是第8行C:\xampp\htdocs\www\ connection\index.php中的字符串”

我使用adobe dreamwaver5和xampp服务器。

第一页:

代码语言:javascript
复制
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>connection</title>
    </head>

    <body>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>

    <body>
    <?php

    $dbhost = 'localhost';
    $dbuser = 'root';
    $dbpass = '';
    $db = 'db_connection';

    $conn = mysql_connect($dbhost,$dbuser,$dbpass);
    mysql_select_db($db);

    ?>



</body>
</html>

</body>
</html>

第2页:

代码语言:javascript
复制
<?php

include 'connection.php';

$query = "SELECT * FROM people";
$result = mysql_query($query);

while($person = $mysql_fetch_arrey($result))
    {
        echo "<h3>".$person['name']."</h3>";
        echo "<p>".$person['description']."</p>";
    }

?>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-06-27 09:55:03

函数的名称是数组,而不是mysql_fetch_arrey。所以while循环应该喜欢:

代码语言:javascript
复制
while($person = $mysql_fetch_array($result)) {
    ....
}
票数 3
EN

Stack Overflow用户

发布于 2011-06-27 09:53:46

错误在这里,$mysql_fetch_arrey

这应该是

代码语言:javascript
复制
while($person = mysql_fetch_array($result))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6491133

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档