On an inded page on my webite a list of genera each directs to a page /species.php?id=x where x = the id of the genus (genid).
On the species page I want to list the species which are all associated with that genus e.g. if the page is /species.php?id=4 I want to show all the species in my database that have a genid=4.
My current code returns all the species in the database and not just those where the genid=url:
$url = $_GET['genid'];
if ($genid == $url)
{
$query = mysqli_query($connect, " SELECT * FROM desmids ORDER BY species ASC");
$row= mysqli_fetch_assoc($query);
$totalRows_query = mysqli_num_rows($query);
}
I know this is because my query is missing the conditional statement that sets the genid equal to the url id.
So how do I format the WHERE genid='url id'?
I have been stuck on this for ages and I'd really appreciate some help
Thank you