Ten Days Society PHP's Sixth Day

xiaoxiao2021-03-06  38

Learning Purpose: Learn to add deletion of modifying data

MySQL_Query ($ EXEC);

This statement can perform all the operations, different is $ exec this SQL statement

Add: $ exec = "INSERT INTO TABLENAME (item1, item2) values ​​('". - POST [' Item1 ']. "',". "" "" "

Delete: $ exec = "delete from tablename where ...";

Modification: $ exec = "Update Tablename Set Item1 = '". $ _ Post [' Item1 ']. "' Where ...";

When you say this, you have to say the form and PHP variable transmission. If one of the form in the form is submitted by POST, then the form file can be used _POST ['ITEM1'] Gets the variable value, the same amount is $ _Get ['Item1']

Is not it simple? But usually $ EXEC will have a problem, as you may be your SQL statement, you will miss. Connect, or 'to enclose the character field. We can comment Mysql_Query ($ exec); the statement uses ECHO $ ​​exec; instead to output $ EXEC to check the correctness. If you still don't know what is wrong with $ exec, you can copy this SQL statement to phpMyAdmin to see its error message. It is also important to note that we don't use some sensitive strings as a field name, otherwise it is likely to have problems, such as Date what. Naming of variables, naming of fields Sometimes sometimes is a benefit of yourself, beginners do not ignore their importance.

Today, I will say this, everyone can DOWN a reference manual for SQL statement, and then study. Continue to say session tomorrow.

转载请注明原文地址:https://www.9cbs.com/read-57585.html

New Post(0)