how to get the first column/td value of a foreach loop : I want to get the ID of a row which I want to use to generate the url.
I am generating the table rows using following code.

    <?
    	$sql="SELECT pID,pName,pBudget,pRate FROM projects ORDER BY id";
    	$result=mysqli_query($con,$sql);
    	$projects = array();
    	while($row = mysqli_fetch_assoc($result))
    	{
    		$projects[] = $row;
    	}
    	foreach ($projects as $row) 
            { 
    			echo "<tr>";
                foreach ($row as $element)
                {
                    echo "<td>".$element."</td>";				
                }
    			echo "<td class=\"actions\">
    					<a href=\"project.php?pID=$element[0]\">
    					Go to Project
    					</a>
    				</td>";
    			echo "</tr>";
            }
    
    ?>

All work fine except the last <td> of the row. (not sure I am using the correct wording.)
Let's say my database table row is 

    pID   |		pName	   | pBudget | pRate
    -----------------------------------------
    12345 | Create Website | 250 	 | hourly 


then I am getting the table rows like this in my page

    <tr>
    	<td>12345</td>
    	<td>Create Website</td>
    	<td>250</td>
    	<td>hourly</td>
    	<td><a href="project.php?pID=h">Got to project</a></td>
    </tr>

Why the last `<td>` does not have the `pID` value '12345' and why there is 'h' ?
I want the last `<td>` to be:

    <td><a href="project.php?pID=12345">Got to project</a></td>