Avatar ·

Error "expects parameter 1 to be resource" in mysql_fetch_array() and other functions

Hello everyone! I just started learning PHP and MySQL, and I have a problem that has me stumped. I'm trying to get data from the database, but I keep getting this error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given Here's my code:
<?php
$connection = mysql_connect("localhost", "root", "");
mysql_select_db("test_db");

$query = "SELECT * FROM users WHERE id = " . $_GET['id'];
$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
    echo $row['name'] . "<br>";
}
?>
I checked that the database connection is established, but I still get this error. What am I doing wrong? How do I properly get data from MySQL? I heard that I need to use some kind of checks, but