Ask the expert to check where the code below is wrong.

Source: Internet
Author: User
The code follows, adding a prompt to add a failure.
 
   
 
  0) {echo "

Add success

";} Else{echo "

Add failed

";} break; Case "Del"://execute delete break ; Case "Update"://execute modification break ; } Iv. Closure of database Mysql_close ($link);? >



Reply to discussion (solution)

$sql = "INSERT INTO news Valuse (null, ' {$title} ', ' {$keywords} ', ' {$author} ', ' {$addtime} ', ' {$content} ')";
Echo $sql; This step prints normally.

Put this SQL statement into the database to execute and see what's wrong with that.

It could be that dbconfig.php doesn't exist.

It could be that dbconfig.php doesn't exist.
Dbconfig.php, and can be linked normally.

No syntax errors, related files exist
Then you should tell me what's wrong with you.

No syntax errors, related files exist
Then you should tell me what's wrong with you.

The dbconfig.php code is as follows:

 
  

The database is as follows:


The title in the database that is not set is not allowed to be empty, but the data you insert is NULL to set the title of the database to allow null

mysql_query ($sql, $link);
Writing
mysql_query ($sql, $link) or Die (Mysql_error ());

Please help me to see what the difference between these two paragraphs:

First paragraph: unavailable//$sql = "INSERT INTO news Valuse (null, ' {$title} ', ' {$keywords} ', ' {$author} ', ' {$addtime} ', ' {$content} ')"; Second paragraph: can be used//$sql = "INSERT INTO news values (null, ' {$title} ', ' {$keywords} ', ' {$author} ', ' {$addtime} ', ' {$content} ')";


If you use the first paragraph above, do not, the second paragraph can be added normally, but did not find out why. Please take a look at it for me.
QQ Wubi Input method is used.

First paragraph: INSERT INTO news Valuse
Second paragraph: INSERT into news values
One is valuse and the other is valuse.

Watch your spelling.

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