You have the parameters to mysql_query
reversed. It should be:
$records = mysql_query("select * from Users", $conn);
Your other issue is with the if
statement. You're checking if
on a query, not on a result set.
Also, I'm sure you probably know but mysql
libraries are deprecated and are being removed. You should really learn to use mysqli
functions as they will be far more useful to you in the future.
Link to MySQLi documentation - It's really no harder than mysql
libraries.
To re-implement in correct libraries:
<?php
$mysqli = new mysqli("localhost", "user", "pass", "database");
$query = $mysqli->query("SELECT * FROM users");
$results = $query->fetch_assoc();
if($results) {
foreach($results as $row) {
echo $row['name'] . " " . $row['pwd'] . "<br/>";
}
} else {
echo "No results found.";
}
?>
Hopefully I didn't just do your whole assignment for you, but it'd probably be worth it to get one more person using mysqli properly.