MQL Query Removal update embedding guidance PHP

Source: Internet
Author: User
Tags php write
For example, there are apple,banna,lemon,orange four tables in a MSQ database, where the Apple table has brand,color,name,comment four fields that require the lookup of name to modify or delete the comment data. How do I write with a full SQL statement? (To ensure successful operation of the example, pay special attention to the specification of punctuation)
PHP Write


Reply to discussion (solution)

What database is used?

The database used is MySQL

Update Apple set ' comment ' = ' xxx ' where name= ' AA '

Is the set followed by double or single quotation marks?

(Below is the complete code, I do not know where is wrong?) It seems to be a grammatical quote problem)



Session_Start ();
if (Isset ($_session[' Nowuser ')) {
$username = $_session[' Nowuser ');
$reason =$_post[' reason '];

Check Forms
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 (' Submit success! );
Else
echo "Submit failed! ";


}else{
Exit (' Please fill out the blanks and submit! ');

}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.