my script returns this error:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\php_test\user_inter.php on line 17

<?php
$db = mysql_connect("localhost");

mysql_select_db("room_p7", $db);

$query = "select * from members";
$result = mysql_query($query);

while($record=mysql_fetch_assoc($result)){

        while(list($fieldname, $fieldvalue) = each($record)){

            echo $fieldname.": <br>".$fieldvalue.":<br><br>";
            }

    echo "<br><br>";

    }
?>

Your connect has no user/password, the query fails.

commented: sorry, didn't saw your answer, bye! +8

Add or die(mysql_error()); both to line 2 and 4 (and also 7 if you want to check the query). Probably you need to set username, password in mysql_connect(), because if there is no database connection, mysql_query() returns false and you get that error.

$result = mysql_query($query);

in this line

$result = mysql_query($query , $db);

Here is the conection string,
My Username - root,
My PW - ;

<?php
$con = mysql_connect("localhost", "root", "") or die("Oops ! Server Not Connected");
$db = mysql_select_db("Your_DB") or die("Oops ! DB Not Connected");
?>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.