I have the following code of a prepared statement
// Get the data about the file $stmt = $mysqli->prepare("SELECT * FROM file WHERE generated_name = ?"); $stmt->bind_param('s', $generated_name); $stmt->execute(); if($stmt->num_rows == 0) return 'Error'; The code above is not working, it's always returning an error even though it shouldn't affected_rows is weirdly returning -1 as well. However, if I leave the prepared approach and do a normal query.. it works perfectly
// Get the data about the file $result = $mysqli->query("SELECT * FROM file WHERE generated_name = '$generated_name'"); if($result->num_rows == 0) return 'Error'; This code works perfectly and doesn't return an error. I have no idea what is wrong. Could you please identify the error?