1

i am just a beginner and simply trying to read data from a db.there are 2 files, one is include file which contains db connection code and another the 2nd part of my given below code.In db, 3 columns there: 1.id, 2.name and 3. description when i try to open the located folder in firefox it shows

"Fatal error: Call to undefined function mysql_fetch_arrey() in C:\xampp\htdocs\www\database connection\index.php on line 8"

the 8 num line is

"while($person = mysql_fetch_arrey($result))"

i am checked the "mysql_fetch_arrey($result)" with "$mysql_fetch_arrey($result)"

but it shows

"Fatal error: Function name must be a string in C:\xampp\htdocs\www\database connection\index.php on line 8"

i use adobe dreamwaver5 and xampp server

1st page :

   <!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>

2nd page :

<?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>";
    }

?>
0

2 Answers 2

3

The function's name is mysql_fetch_array, not mysql_fetch_arrey. So your while loop should like:

while($person = $mysql_fetch_array($result)) {
    ....
}
Sign up to request clarification or add additional context in comments.

1 Comment

ohh!!...how silly i am...:P....yes, u right. It was a spelling mistake. i must improve my observation capability and thanks a lot dear, for your suggestion.
0

Typo here $mysql_fetch_arrey

This should be

while($person = mysql_fetch_array($result))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.