Explain in detail how PHP uses the DOMDocument class to traverse, add, modify, and delete XML node operations
Dom (Document object model) document-object-model, the core idea is to treat an Xml file as an object model, and then operate the Xml file through the object. Let’s first summarize the attribute methods of DOM objects, and then use cases to illustrate their applications! DOMDocument Attributes: Attributes stores the list of attributes for the node ( Dom(Document object model)document–object– model, the core idea is to put a Xml file as an object model, and then manipulate the Xml file in the form of an object. Let’s summarize the attribute methods of the DOM object first, and illustrate its application with cases! DOMDocument Attributes: AttributesA list of attributes for storage nodes(read-only) childNodesStorage node’s child node list(read-only) dataTypeReturns the data type of this node DefinitionDefinition of a node given in DTD or XMLschema(read-only) Doctype Specifies the document type node(read-only) documentElementreturns the root element of the document(readable and writable) firstChildreturns the first child of the current node(read-only) ImplementationreturnsXMLDOMImplementationobject lastChildreturns the last child node of the current node(read-only) nextSiblingreturns the next sibling of the current node(read-only) nodeNamereturns the name of the node(read-only) nodeTypereturns the type of the node(read-only) nodeTypedValuestorage node value(readable and writable) nodeValuereturns the text of the node(readable and writable) ownerDocumentreturns the root…
Add, delete, modify, view operations of PHPSESSION
The difference between SESSION and COOKIE is firstly that the file of COOKIE is saved on the client, while the session is saved on the server. In comparison, in order to improve certain security, session has more advantages. Because the session is generally managed by the server manager on the server side, but the COOKIE is saved on the client side, and anyone can read it. If not specified, the password is also saved in plain text, and the security is obvious. And the session is relatively more powerful, it can save arrays, even objects, etc., to a certain extent, it can reduce the development cost. The following is the session usage code: Increase of session data: The code is as follows: <?php header(“Content-type: text/html; charset=utf-8;”);//Display in utf-8, has nothing to do with session session_start();//Start session data saving $_SESSION[‘name’]=”xuning”;*//Add session data. ?> Deletion of session data. The code is as follows: <?php header(“Content-type: text/html; charset=utf-8;”);//Display in utf-8, has nothing to do with session session_start();//Start session data unset($_SESSION[‘name’]=”xuning”);*//Delete session data. session_destory();//Delete all sessions ?> The modification of the session is the increase of the session data. View the session data, that is, take out the session data. The code is as…

Add, delete, modify, check classification information (Jquery+Ajax+PHP+MySQL)
This article will use Jquery+Ajax+PHP+MySQL to realize the management of customer classification, and use jNotify to prompt the operation results. There are demos, free download links at the bottom of the page. If you want to see more js special effects, website source code, js tutorial, please visit [Material Fire] http://www.sucaihuo.com/ js also has a demo DEMO, the most important thing is that it can be downloaded for free. 1, Table ·catalist· CREATE TABLE `catalist` ( `cid` int(11) NOT NULL auto_increment, `title` varchar(100) NOT NULL, `sort` mediumint(6) NOT NULL default '0', PRIMARY KEY (`cid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 2. Then load the jquery library, the operation result prompt plug-in jNotify and the deletion confirmation plug-in hiAlert index.php 3. We first traverse the data in the table ·catalist·, and add, delete and modify buttons for each item, and add an increase button at the bottom. <?php $query = mysql_query(“select * from catalog order by cid asc”); while($row=mysql_fetch_array($query)){ $list .= ” “.$row[' title'].” “; } ?> HTML 4. Then we put the traversed list into #catalist in the form of a string, the code is as follows: Customer Category Add a new item jQuery The operation mode added in global.js is as…
Add, delete, modify, view operations of PHPSESSION
The difference between SESSION and COOKIE is firstly that the file of COOKIE is saved on the client, while the session is saved on the server. In comparison, in order to improve certain security, session has more advantages. Because the session is generally managed by the server manager on the server side, but the COOKIE is saved on the client side, and anyone can read it. If not specified, the password is also saved in plain text, and the security is obvious. And the session is relatively more powerful, it can save arrays, even objects, etc., to a certain extent, it can reduce the development cost. The following is the session usage code: Increase of session data: The code is as follows: <?php header(“Content-type: text/html; charset=utf-8;”);//display in utf-8, has nothing to do with session session_start();//Start saving session data $_SESSION[‘name’]=”xuning”;*//Add session data. ?> Delete session data. The code is as follows: <?php header(“Content-type: text/html; charset=utf-8;”);//display in utf-8, has nothing to do with session session_start();//Start session data unset($_SESSION[‘name’]=”xuning”);*//Delete session data. session_destory();//Delete all sessions ?> The modification of the session is the increase of the session data. View the session data, that is, take out the session data. The code is as follows:…
Add, delete, modify and query data in PHP pages
main page (main page) Code name Name Gender Ethnicity birthday Operation <?php $db = new MySQLi(“localhost”,”root”,””,”mydb”); !mysqli_connect_error() or die(“Connection failed”); $sql = “select * from Info”; $result = $db->query($sql); $attr = $result->fetch_all(); foreach($attr as $v) { $sex = $v[2]? ‘Male’:’Female’; $sqln = “select Name from Nation where Code =’$v[3]'”; $rnation = $db ->query($sqln); $attrn = $rnation->fetch_assoc(); echo ” {$v[0]} {$v[1]} {$sex} {$attrn[‘Name’]} {$v[4]} $v[0]}’>delete $v[0]}’>Modify “; } ?> Add data Add (add data page) 1 Add data 2 3 Code: 4 Name: 5 Gender: 6 male 7 female 8 9 Nationalities: 10 11 <?php 12 $db = new MySQLi(“localhost”,”root”,””,”mydb”) ; 13 !mysqli_connect_error() or die(“Connection failed!”); 14 $sql = “select * from Nation”; 15 $r = $db->query($sql); 16 $att = $r->fetch_all(); 17 foreach($att as $v ) 18 { 19 echo “<option value='{$v[0]}’>{$v span>[1]}”; 20 } 21 ?> 22 23 24 Birthday: 25 26 AddChuLi page (add data processing page) 1 <?php 2 $code = $_POST[“code”]; 3 $name = $_POST[“name”]; 4 $sex = $_POST[“sex”]; 5 $s = 1; 6 if($sex ==”female”) 7 { 8 $s=0; 9 } 10 $nation = $_POST[“nation”]; 11 $birthday = $_POST[“birthday”]; 12 $db = new MySQLi(“localhost”,”root”,””,”mydb”) ; 13 !mysqli_connect_error() or die(“Connection failed!”); 14 $sql = “insert into Info…
TP5 check, add, delete, change PHP and HTML front and back connection
PHP code <?phpnamespace app\index\controller;use phpDocumentor\Reflection\DocBlock\Tags\Param;use think\Controller; >use think\Request;class Shijian extends Controller{ public function index(){ // Extract from the database $data = db(“teacher”) ->select(); //Assign to the front section, two snakes $this->assign(“teacher”, $data); //Return this method to display html > return view(); }public function view_tianjia(){ $data=db(“teacher”)->select(); $this->assign(“teacher”, $data); return view();}public function do_tianjia(){ $datas=$_POST; $res=db(“teacher”)->insert($_POST) ; if ($res){ return “submit successfully”; }else{ return “submit failed”; }} //From the index page In the page after clicking delete, add the id to the deleted key in index, and add id to href, so that we know which one we want to delete in the background. //1, Get the value of id // 2. Put this id into where and delete the data of this id in the database, ->delete(); //Return to delete successfully, otherwise delete Failedpublic function delete(){ $id=Request::instance()->param(“id”); $data=db(“teacher”)->where(“id” ,$id)->delete(); if($data){ return “delete successfully”; }else{ return “delete failed”; } }public function view_edit(){$id=Request::instance()->param(“id”);$data=db(“teacher”)->where(“id” ,$id)->find();$this->assign(“id”,$data[“id”]);$this->assign(“name”,$data[“name “]);$this->assign(“sex”,$data[“sex”]);$this->assign(“username”,$data[“username”]);$this->assign(“email”,$data[“email”]);return view();}public function do_edit(){ $id=Request:: instance()->param(“id”); $datas=$_POST; //Receive all the information from the frontend $data=db(“teacher”)->where(“id”,$ id)->update($datas); if ($data){ return “modified successfully”; }else{ return “modified failed”; } }} index.htmlcode Number Name Gender Username Email Operation {volist name=”teacher” id=” vo”} {$vo.id} {$vo.name} {$vo .sex} {$vo.username} {$vo.email} Delete modification {/volist} view_tianjia.html Name: Sex:…

Add, delete, modify and check sql statements in php, add, delete, modify and check syntax of SQL database
SQL SELECT syntax SELECT column_name,column_name FROM table_name; With SELECT * FROM table_name; SQL INSERT INTO syntax INSERT INTO statement can have two writing forms. The first form does not need to specify the column name to insert data, just provide the value to be inserted: INSERT INTO table_name VALUES (value1,value2,value3,&# 8230;); The second form needs to specify the column name and the value to be inserted: INSERT INTO table_name (column1,column2,column3,…) VALUES (value1 ,value2,value3,…); SQL UPDATE syntax UPDATE table_name SET column1=value1,column2=value2,… WHERE some_column=some_value; SQL DELETE syntax DELETE FROM table_name WHERE some_column=some_value; Recommended tutorial: sql tutorial

Add, Modify or Delete Windows Registry Keys and Values Using a Registry File (REG)
class=”markdown_views prism-atom-one-dark”> Reposted from [Blog Garden: The first happiness ever] 1. Introduction We usually use the regedit registry editor to modify the registry, but this kind of manual operation is time-consuming and laborious. When we want to modify the registry on multiple PCs, we will complain. And in some cases, if the Registry Editor is disabled, this method will also fail. Therefore, it is recommended that you use the REG file to quickly complete the registry modification. A REG file is actually a registry script file, and the regedit registry editor can use a REG file to import and export registry subkeys and values. Double-click the REG file to import the data into the registry. We can use the REG file to directly modify the registry without being restricted by the registry editor being disabled. As opposed to importing, you can use the regedit registry editor to export the specified items in the registry to a REG file for easy backup. REG files can be distributed to multiple PCs for batch registry modification. REG files can be modified with any text file editing tool, and it can achieve twice the result with half the effort and unexpected effects after mastering…