If you call your script with something like
somefile.php?id=8 in the URL, then in PHP those key/value pairs will be available in the
$_GET "super-global" array. In this example,
$_GET['id'] would have a value of "8". You could therefore use that array element in your DB query, being sure to sanitize it as applicable for the database extension you're using to avoid SQL injection attacks (or accidents).