> delete& lta href=\"update.php? id" />
Current location - Education and Training Encyclopedia - Graduation thesis - How to delete the modified message by writing message board code in PHP? What is the code?
How to delete the modified message by writing message board code in PHP? What is the code?
List.php, modify it.

Add a line after the message displayed on each floor.

& lta href="del.php? id = & lt? PHP echo $ row[' id ']; ? >> delete

& lta href="update.php? id = & lt? PHP echo $ row[' id ']; ? >> editor

Then establish the del.php document.

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

if (isset($_GET['id']))

{

Include_once (set the php file of mysql connection);

MySQL _ query(' DELETE FROM ` bbtliuyanban ` WHERE ` id ` = \ ' '。 $_GET['id']。 \'');

}

& gt

In short, mysql_query should execute the delete statement.

The point is that GET receives the passed ID value.

Establish update.php.

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

Include_once (set the php file of mysql connection);

If (! Empty ($_POST))

{

MySQL _ query(" UPDATE ` bbtliuyanban ` SET ` user ` = ' $ _ POST[user]',` title` = '$_POST[title]',` content ` = ' $ _ POST[content]' WHERE ` id ` = ' $ _ POST[id]' ");

}

if (isset($_GET['id']))

{

$ result = MySQL _ query(' SELECT * FROM ` bbtliuyanban ` WHERE ` id ` = \ ')。 $_GET['id']。 \'');

$ row = MySQL _ fetch _ array($ result);

& gt

Output bidding information

& ltform action = " update . PHP " method = " POST " & gt;

& ltinput type = " hidden " name = " id " value = " & lt; ? PHP echo $ row[' id ']; ? >/& gt;

Title:

User:

& lttextarea name = " content " & gt& lt? PHP echo $ row[' content ']; ? & gt& lt/textarea & gt;

& ltinput type = " submit "/& gt;

& lt/form & gt;

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

}

& gt

Turn off the computer temporarily. I am in a hurry. Let's talk about it tomorrow if there is a problem.

Update is not missing braces, is it?

Finally, didn't you notice?

You can delete rows that output form information. You just need to copy all the codes from update.php to the temporary opening of the computer. You can correct your mistakes by yourself and enter them directly here. Don't pay too much attention to details.

Permission requires a cookie and a session.

You have only studied for three days. . . The spirit is willing but the flesh is weak.

What you said downstairs is quite right, but one thing, you can only delete or modify it with the administrator's permission.

So there is basically no need to judge del.

Sql prevention is still necessary, thank you for reminding me.