This delete operation is abnormal-php Tutorial

Source: Internet
Author: User
What is the error in deleting this delete? & Lt; table & gt; & lt; tr & gt; & nbsp; & lt; td & gt; & nbsp; & lt; td & gt; & lt; pstyle & quot; font-size: 13px; font-weight: bold; & quot; & gt; PaperTitle & lt; p & gt; & lt; what is the error in deleting this delete?






















$ Con = @ mysql_connect ("localhost", "root", "") or die ("failed to connect the database ");Mysql_select_db ("iccp", $ con );Mysql_query ("set names 'gbk '");$ SQL = "select * from t_paper where contributor_id = 118 ";$ Query = mysql_query ($ SQL );While ($ row = mysql_fetch_array ($ query )){?>

Paper Title

Comments

Upload Date

Delete


}
If (! Empty ($ _ POST ['name']) {
$ Str = explode (",", $ _ POST ['name']);
Mysql_query ("delete from t_paper where paper_title in ($ str )");}
?>


Why can't I get the value of $ _ POST ['name ']?

------ Solution --------------------
No form
------ Solution --------------------
In addition, isset () should be used to determine whether a form is submitted ()
PHP code
If (isset ($ _ POST ['name']) {$ str = explode (",", $ _ POST ['name']); mysql_query ("delete from t_paper where paper_title in ($ str)"); // There is a clear problem here. The explode () function returns an array and the SQL statement syntax is incorrect}

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.