I have a URL that is dynamically generated:

<https://mywebsite.co.uk/report.php?taskid=25&rep=1&rep=2&rep=3>

I can retrieve the variable for the task ID and rep fine:

```
if (isset($_GET['taskid'])) { $taskid = $_GET['taskid']; }
if (isset($_GET['rep'])) { $referenceID = $_GET['rep']; }

```

What I'm trying to do is create an SQL statement on the page that selects a row based on the rep number in the URL. For example:

```
SELECT TASK_ID, ID, NAME FROM mytable WHERE TASK_ID = $taskid AND ID = $referenceID

```

However, when I echo the result of $referenceID it is always the last rep, so in this case 3. How do I select the rows from the database where ID = 1,2 & 3?

I then want to display each row, so it would be something like:

```
<table>
$result = mysqli_query($con,"SELECT TASK_ID, ID, NAME FROM mytable WHERE TASK_ID = $taskid AND ID = $referenceID");
while($row = mysqli_fetch_array($result))
{
$ID = $row['ID'];
$NAME = $row['NAME'];
print "<tr><td>$ID</td><td>$NAME</td></tr>";
}
</table>

```

This query should return 3 rows in the table with the ID AND NAME in each row.

Your help would be appreciated.