I'm very basic at coding and have the following snippet of code
$connection = new PDO($dsn, $username, $password, $options);
$sql = "SELECT *
FROM birds
WHERE Species Like :Species";
$Species = $_POST['Species'];
$statement = $connection->prepare($sql);
$statement->bindParam(':Species', $Species, PDO::PARAM_STR);
$statement->execute();
$result = $statement->fetchAll();
} catch(PDOException $error) {
echo $sql . "<br>" . $error->getMessage();
}
}
it works fine so long as the spelling is correct. how can I add a wildcard to the search feature as all variations I've tried don't seem to be working.
I was also wondering how I could get it to find data in a few columns based on the results entered in form. i.e. search name or location or age from one text field.