PDO::ERRMODE_EXCEPTION )); } catch (Exception $e) { die("Error : ".$e->getMessage()); } $q = $_REQUEST['q']; $req = $db->prepare("SELECT taxon_species FROM `taxa` WHERE (id LIKE '%$q%' OR lower(taxon_phylum) LIKE '%$q%' OR lower(taxon_kingdom) LIKE '%$q%' OR lower(taxon_class) LIKE '%$q%' OR lower(taxon_order) LIKE '%$q%' OR lower(taxon_family) LIKE '%$q%' OR lower(taxon_subfamily) LIKE '%$q%' OR lower(taxon_tribu) LIKE '%$q%' OR lower(taxon_genus) LIKE '%$q%' OR lower(taxon_species) LIKE '%$q%')"); $req->execute(); $result = $req->fetchAll(); // print_r($result); $species = array(); foreach ($result as $row) { $species[] = $row['taxon_species']; } // print_r($species); // Output "no suggestion" if no hint was found or output correct values ?>