|
Learning Objective: To learn to add amended to delete data
mysql_query ($ exec);
This statement alone can perform all the operations, is different this $ exec sql statement
Add: $ exec = “insert into tablename (item1, item2) values (’”.$_ POST [ ‘item1′].”‘,”.$_ POST [’ item1′].”)”;
Delete: $ exec = “delete from tablename where …”;
Laws: $ exec = “update tablename set item1 =’”.$_ POST [ ‘item1′].”‘ where …”;
Having said that we should talk about the form and php variable transmission, if the form of a <input name = “item1″ type = “text” id = “item1″>
POST to submit the form, then the document can be dealt with the form used $ _ POST [ ‘item1′] are variable values, the same is submitted to GET $ _ GET [ ‘item1′]
Is not very simple » But usually $ exec a problem, because the SQL statement you may be very long, you will be missed. Connectors, or ‘to field surrounded character.
We can note mysql_query ($ exec); statement to echo $ exec; replace the output to $ exec to check the accuracy. If you are not able to detect $ exec what is wrong, they can copy this sql statement to phpmyadmin in the implementation to see if it’s an error message. Still needs attention is that we do not use some sensitive field as a string of names, or is likely to have problems, for instance, what the date. The naming of variables, fields that followed the naming of some of their time is a good, beginners can not ignore its importance. |
|
|
|
 |
RSS feed for comments on this post · TrackBack URI
Leave a reply