Using the language to manipulate the database is the most serious, if a language you do not know how to operate the database, then you still do not learn the language.
PHP's approach to manipulating databases is not difficult
The PHP value can also be controlled with JavaScript scripts,
Typically PHP values are passed to JavaScript, and generally do not operate in reverse
I. BASIC OBJECTIVES
First, there is a user information table in MySQL,
The fields are id,username and password, respectively.
To open the Web page dbselect.php, first use PHP to find the entire user table:
You can then insert data into the user table in MySQL by inserting data into a column of data.
In the column that modifies the data, the first drop-down menu is created by JavaScript,
The number of drop-down options given based on how much data is in the table.
The second drop-down menu lets the user select the column to modify
The third input box is for the user to enter a value to modify
As for why the deletion data is not done, it is because the operation to delete data is similar to the modification data, second, because the data is not deleted in the self-increment table, just set the key value so that the data is hidden
Second, the basic idea
The program entrance is dbselect.php, the process of manipulating the database is two new pages, one dbinsert.php, one is dbupdate.php, the two pages operate the database, immediately through JavaScript return.
Third, the production process
(1) dbselect.php
is also the most complex page in the implementation process.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
JavaScript control HTML node details, you can refer to my previous "JavaScript" page node additions and deletions of the article (click to open the link)
(2) dbinsert.php
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
(3) dbupdate.phpIt's exactly the same as the dbinsert.php logic, just mysql_query that query, from the INSERT INTO statement to the UPDATE statement.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">