How can I with mysqli make a query with LIKE and get all results?
Here’s how you properly fetch the result $param = “%{$_POST[‘user’]}%”; $stmt = $db->prepare(“SELECT id, username FROM users WHERE username LIKE ?”); $stmt->bind_param(“s”, $param); $stmt->execute(); $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { echo “Id: {$row[‘id’]}, Username: {$row[‘username’]}”; } or, if you prefer the old fetch and bind_result syntax, you can also do: $param = “%{$_POST[‘user’]}%”; … Read more