I want to query a MySQL database. I have the following. $name keeps changing in a loop. ($query is a sample query here)
$query = "SELECT id FROM table1 WHERE name='$name';";
$result = mysql_query($query) or die(mysql_error());
echo "$result<br/>";
While ($row = mysql_fetch_array($result)) {
echo $row["id"] . " - " . $row["name"];
}
with the echo "$result<br/>" it just prints something like Resource id #. Nothing from $row is printed. The MySQL connection is fine. If I run the query without PHP, it works fine. What might be wrong?