Learning Purpose: Learn to add delete modify data
mysql_query ($exec);
Single This statement can perform all the operations, the difference is $exec this SQL statement
Add: $exec = INSERT INTO tablename (ITEM1,ITEM2) VALUES ('. $_post[' item1 ']. "', ' $_post[' item1 ']."
Delete: $exec = "Delete from tablename where ...";
Modified: $exec = "UPDATE tablename set item1= '". $_post[' item1 '. "' Where ... ';
Speaking of which, we'll talk about forms and PHP variable delivery if one of the forms
The form is submitted by POST, then processing the form file can get the value of the variable with $_post[' item1 ', which is also the $_get[' item1 ' submitted.
Is it simple? But usually $exec can be problematic because your SQL statements may be very long, and you'll miss out. Connectors, or ' to surround character fields.
We can annotate mysql_query ($exec); statements use echo $exec instead to output $exec to check for correctness. If you are not aware of any $exec errors, you can copy the SQL statement to phpMyAdmin and see its error message. It is also important to note that we do not use sensitive strings as field names, otherwise there are likely to be problems, such as date or something. The name of the variable, the name of the field follow a little rule sometimes it's a good thing for yourself, and beginners can't ignore its importance.
Today is the point, tomorrow will continue the session.