html - How to delete the entire row in table using PHP? -


How to add a delete button to remove it completely in MySQL DB. Below is the code and how can I delete the row using the id that is the primary key ..

   & Lt; Td & gt; $ Line ['first name']. '& Lt; / TD & gt; & Lt; Td> '. $ Line ['last name'] '& lt; / Td> & Lt; Td> $ Line ['email']. '& Lt; / TD & gt; & Lt; Td> '. $ Line ['mobile'] '& lt; / Td> & Lt; Td & gt; $ Line ['gender']. '& Lt; / TD & gt; & Lt; Td> & Lt; A href = "" & gt; Remove & lt; / A & gt; & Amp; Emsp; & Lt; / TD & gt; & Lt; / TR & gt; '; } Echo '& lt; / Table & gt; '; ? & Gt;  

Link your deleted anchor to new page

 < Code> & lt; A href = "delete.php? Id = '. $ Line [' id ']." & Gt; Remove & lt; / A & gt;  

and at delete.php

  if (! ($ _ GET ['id'])) {$ id = trim ($ _ GET) [ Id ']); $ Query = mysql_query ("Remove from test where id = '$ id'"); If ($ query) {// success returns to second page}}  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -