0

I am trying to send a specific cell to a PHP page and deleting that row which contains this specific cell. But it appears I am doing something wrong.

This is how I sending the information:

echo "<td><a href='delete.php?id= '$row['pid']''>Delete</a>< /td>"; 

and using it like this:

$del = "DELETE FROM sca WHERE pid =  $_GET['id']";

My database connections are working well but I couldn't manage to send the 'pid' integer to a PHP page.

Thanks

1 Answers1

0

Probably you misstiped some character. Try with this :

        echo "<td><a href='delete.php?id=".$row['pid']."'>Delete</a></td>"; 
        echo '<td><a href="delete.php?id='.$row['pid'].'">Delete</a></td>'; 
        echo "<td><a href='delete.php?id={$row['pid']}'>Delete</a></td>"; 

Try to keep this code mixture (html and php) readable or improve it for future changes and revisions.

Make sure to receive correct value in $row['pid'].

Also as advice you should protect your data and clean it before any db interaction.

Community
  • 1
  • 1
Alejandro Quiroz
  • 2,604
  • 1
  • 15
  • 17