diff --git a/public/home/last-uploaded-file.php b/public/home/last-uploaded-file.php index 0431c97..39449df 100755 --- a/public/home/last-uploaded-file.php +++ b/public/home/last-uploaded-file.php @@ -13,7 +13,7 @@ try { die("Error : ".$e->getMessage()); } -$req = $db->prepare('SELECT id, recordist_name, file_name, license, species, sound_type, date, time FROM `records` ORDER BY `entry_timestamp` DESC LIMIT 1'); +$req = $db->prepare('SELECT * FROM `records` ORDER BY `entry_timestamp` DESC LIMIT 1'); $req->execute(); if ($data = $req->fetch()) { @@ -22,17 +22,12 @@ if ($data = $req->fetch())

at

- - " alt="bat sound spectrogram"> -

+
+ +
getMessage()); } - -$req = $db->prepare('SELECT taxon_species FROM `taxa`'); +$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']; } - -$q = $_REQUEST['q']; - -$hint = array(); // print_r($species); -if ($q !== "") { - $q = strtolower($q); - $len = strlen($q); - foreach($species as $sp) { - if (stristr($q, substr($sp, 0, $len))) { - $hint[] = $sp; - } - } -} - // Output "no suggestion" if no hint was found or output correct values ?> - timeoutInMs) + if (document.querySelector(selector) != null) { + callback(); return; - loopSearch(); - }, checkFrequencyInMs); - } + } else { + setTimeout(function() { + if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs) + return; + loopSearch(); + }, checkFrequencyInMs); + } })(); } // Call the below function -waitForElementToDisplay("#species-hint", function(){ +waitForElementToDisplay("#species-hint", function() { this.addEventListener('click', function() { - species_select = document.getElementById('species-hint') - document.getElementById('species').value = species_select.value; - // console.log(species_select.value); + species_select = document.getElementById('species'); }); -},1000,9000); +}, 1000, 9000); \ No newline at end of file diff --git a/public/upload/upload.php b/public/upload/upload.php index be8cb05..9fddab0 100644 --- a/public/upload/upload.php +++ b/public/upload/upload.php @@ -12,7 +12,10 @@
- " id="species" placeholder=""> + " id="sp-entry" placeholder=""> +