nvidia geforce 8500 gt php deletes page records and refreshes the page at the same time. The deletion conditions are obtained using GET.

WBOY
Release: 2016-07-29 08:47:40
Original
1307 people have browsed it

Function:
1. Display query data on a certain page, and add a delete function after each piece of data. Click "Delete" to delete the data and refresh the page at the same time.
2. Use GET to obtain deletion conditions.
Database connection variables connectvars .php

Copy the code The code is as follows:


//Server
define('DB_HOST', 'localhost');
//Username
define('DB_USER', 'root ');
//Password
define('DB_PASSWORD', 'root');
//Database
define('DB_NAME','test');
?>


Record display page display.php, each There is a "Delete" function after a record. Click "Delete" to delete the record and refresh the page at the same time

Copy the code The code is as follows:


require_once 'connectvars.php';
$dbc = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
//If there is a 'DelID' variable in the page link when calling this page, get the 'ID' number of the record to be deleted and delete it
if(isset( $_GET['DelID'])){
$query = "DELETE FROM toyota WHERE ID = ".$_GET['DelID']." LIMIT 1";
mysqli_query($dbc,$query);
}
/ /Find all records and display them in the following table (if the above deletion code is executed, this is equivalent to refreshing the page)
$query = "SELECT * FROM toyota ORDER BY ID DESC";
$data = mysqli_query($dbc,$query);
//Count the number of queried records
$count = mysqli_num_rows($data);
?>


Toyota View car data





';
echo ' ';
echo '';
echo ' ';
//Click the "Delete" link to call your own page, and add the 'DelID' variable to the page link and assign it to this record The 'ID' number in the database is used for GET method to obtain
echo '';
echo '';
}
?>
Title<
Source ;/tr>
//Loop output list elements: title, source, carType, majorPart, followed by a "delete" link
while($row = mysqli_fetch_array($data)){
echo '< tr>';
echo '
'.$row['title'].''.$row['source'].''.$row['carType'].''.$row['majorPart'].'Delete





The above introduces nvidia geforce 8500 gt php to delete page records and refresh the page at the same time. The deletion conditions are obtained through GET, including the content of nvidia geforce 8500 gt. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!