Recently in the Learning database PHP + MySQL basic crud operation, record the pit for your reference. The SQL statements you need to use in crud are still more, including the following:
- Querying all data
- Querying a field in a table
- Query and sort ascending by ID
- New, to pass the parameter in the URL
- New, pass through the object parameter
- Delete
- Page out
- Modify
Table structure:
Query and sort by table ID:
// user_id = "Select*fromORDERbyuser_id";
To query all the data in a table:
= "select * from ' t_users '";
New, the parameter is passed in the URL:
/*get data sent from the client*/$userName=$_get[' user_name ']; $userAge=$_get[' User_age ']; $userSex=$_get[' User_sex '];/*INSERT into table name (column name 1, column Name 2, ...) VALUES (' corresponding data 1 ', ' corresponding data 2 ', ... )*//*values are all strings, because the table property is set to a string*/$sql="INSERT intoT_users (user_name, User_age,user_sex)VALUES('$userName','$userAge','$userSex')";
Delete, delete according to table ID, bulk Delete:
/**= $_get[' rowId ']= " Delete from where user_id = ' $rowId '";
Website Add/delete/change/Chashi Common SQL statements