Mql query deletion update embedding guide php-php Tutorial

Source: Internet
Author: User
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 ');
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.