Home php Deleting lines from database mysql

Deleting lines from database mysql




I write to PHP. In general, my database data is placed in an array and then the cycle in the contamination is displayed. It is necessary to make a link to remove a specific string. Only here I do not even have a concept, how the links will look like how to make a program, etc. Help please

Answer 1, Authority 100%

session_start ();
Require "db.inc.php";
Require "lib.inc.php";
$ id = $ _get [id "];
PageDel ($ ID);
HEADER ("Location: index.php");
FUNCTION PAGEDEL ($ ID) {// Page Removal Function
  $ sql = "delete from pages where id = $ id";
  MySQL_Query ($ SQL) or DIE (mysql_error ());

But this will look like a link to the removal itself

& lt; a href = "delete-form-page.php? id = & lt;? = $ items [" id " ]? & gt; "& gt; Remove & lt; / a & gt;`

Answer 2

delete from `tablename` Where` id` = '{id}';

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions