Fetch only one row in PHP/MySQL

Probably your $query is equal false because something went wrong, try mysql_error() to see whats wrong.

And 2 small advices:

  1. would be better to use PDO od mysqli as mysql_* functions are deprecated.

  2. use at least mysql_real_escape_string() to escape the value before putting it into SQL string


Please, don't use mysql_* functions in new code. They are no longer maintained and the deprecation process has begun on it. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

Try with:

$query = mysql_query("SELECT * FROM friendzone WHERE ID = '$editID'");
$row = mysql_fetch_array($query);

print_r($row);

MySQLi code:

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$conn = new mysqli('host', 'username', 'password', 'database');
$stmt = $conn->prepare("SELECT * FROM friendzone WHERE ID = ?");
$stmt->bind_param("s", $editID);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();

print_r($row);