Mql query, delete, update, embed, and guide php. for example, an msq database contains four tables: apple, banna, lemon, and orange. The apple table contains four fields: brand, color, name, and comment, it is required to modify or delete comment data by searching for the name. how can I write a complete SQL statement? (For examples of successful running, pay special attention to punctuation standards)
Php write
Reply to discussion (solution)
What database is used?
The database used is mysql.
Update apple set 'comment' = 'XXX' where name = 'A'
Is set followed by double quotation marks or single quotation marks?
(The following is the complete code. I don't know where the error is? It seems to be a syntax quotation mark problem)
Session_start ();
If (isset ($ _ SESSION ['nowuser']) {
$ Username = $ _ SESSION ['nowuser'];
$ Reason = $ _ POST ['reason '];
// Check the form
If (strlen ($ reason)> 0 ){
$ SQL = "select * from module1 where username = '". $ username ."'";
Update reason set 'comment' = '$ reason 'Where name =' $ username ';
$ SQL = "INSERT INTO module1 (reason) VALUES ('reason ')";
If (mysql_query ($ SQL, $ conn ))
Exit ('submitted successfully !);
Else
Echo "submission failed! ";
} Else {
Exit ('fill in the blank space and submit again! Return ');}
} Else {
Exit ('not logged in! Return ');
?>