I have a "search" form which posts to a result page showing the portion of a database that researchers can modify. On the search page I have put a hidden field that applies to them. In other words, if a researcher can modify the animal phylum "mollusca", I have created a hidden field "phylum" with a value of "mollusca" on the search page.
On the results page I (Dreamweaver) have placed the following query:
$varphylum_rsphylum = "%";
if (isset($_GET['phylum'])) {
$varphylum_rsphylum = (get_magic_quotes_gpc()) ? $_GET['phylum'] : addslashes($_GET['phylum']);
}
mysql_select_db($database_connfauna, $connfauna);
$query_rsphylum = sprintf("SELECT * FROM newsp_taxon WHERE phylum LIKE '%%%s%%' ORDER BY orden, familia, taxon asc", $varphylum_rsphylum);
$rsphylum = mysql_query($query_rsphylum, $connfauna) or die(mysql_error());
$row_rsphylum = mysql_fetch_assoc($rsphylum);
$totalRows_rsphylum = mysql_num_rows($rsphylum);
simply put this is the query I am using
mysql_query=("SELECT *FROM newsp_taxon
WHERE phylum LIKE '%varphylum%'
ORDER BY orden, familia, taxon ASC")
varphylum has a default value of % and a runtime value of $_GET['phylum']
The problem is is that the result page shows ALL the records in the database and not just those with the value "mollusca".
Any idea what I am doing wrong???
Many thanks
Jarow