Ajax allows you to delete data and View Details.
Use bootstrap, jquery, and ajax to display some data, add the delete function, and click it to bring up the modal box details function.
Main. php
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Data Loading page jiazai. php
<? Phpinclude (".. /FENGZHUANG/DBDA. class. php "); $ db = new DBDA (); $ SQL =" select * from nation order by code ASC "; $ arr = $ db-> Query ($ SQL ); // The following implementation string is like this n001 ^ Han nationality | n002 ^ Hui Nationality | n003 ^ Miao $ str = ""; the data returned on the home page is of the TEXT type, you have to convert foreach ($ arr as $ v) {$ str = $ str. implode ("^", $ v ). "|"; // concatenated string} $ str = substr ($ str, 0, strlen ($ str)-1); // remove the ending | character. Echo $ str;
Delete shanchu. php from the processing page
<?phpinclude("../FENGZHUANG/DBDA.class.php");$db = new DBDA();$code = $_POST["code"];$sql = "delete from nation where code='{$code}'";if($db->Query($sql,0)){ echo "OK";}else{ echo "NO";}
View xiangqing. php on the details page
<?php$code = $_POST["code"];include("../fengzhuang/DBDA.class.php");$db = new DBDA();$sql = "select * from nation where code='{$code}'";echo $db->StrQuery($sql);