I am trying to get the details of a person using their id, I have the following code and it's showing me an error.
$id = isset($_GET['id']) ? isset($_GET['id']) : "";
$sql = "SELECT * FROM `ArtListing` where `id` = $id";
$result = $conn->query($sql);
if (!$result) {
die("Query failed " . $conn->error);
}
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo $row["id"] . "." . $row["name"] ;
}
If I use where the id is some random number like it gives me back the details. The error it's showing me is as following
Query failed You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1