Php database data insertion problems, life and death cannot be inserted, please great God guide-php Tutorial

Source: Internet
Author: User
Php database data insertion problem, life and death cannot be inserted in, please guide this post last by hipyaohop in 2013-06-2810: 12: 39 edit jquery code: $ (. detailtextable ). click (function & nbsp; () & nbsp ;{& nbsp; & nbsp; $ s_keshi $ (. the cl php database cannot be inserted for data insertion.

This post was last edited by hipyaohop at 10:12:39

Jquery code:
$ (". Detailtextable"). click (function (){
$ S_keshi = $ (". cla_title"). attr ("alt ");
$ S_month = $ (". nyr_center"). attr ("alt ");
$ S_day = $ (this). attr ("alt ");
$. Ajax ({
Type: "POST ",
Url: "http: // localhost/hos1/orderinsert. php ",
Data: {skeshi: $ s_keshi, smonth: $ s_month, sday: $ s_day },
Success: function (){
Alert (1 );
}
});
});
$ S_day, $ s_keshi .. there is data in it, alert passed.
Orderinsert. php code:
Session_start ();
$ Con = mysql_connect ("localhost", "root", "mysql ");
If (! $ Con)
{
Die ("cocould not connect:". mysql_error ());
}
$ Pkeshi = $ _ POST ['skeshi'];
$ Pmonth = $ _ POST ['smonth'];
$ Pday = $ _ POST ['sday'];
Mysql_select_db ("hos_db", $ con );
$ SQL = "INSERT INTO orderlist (keshi, month, day)
VALUES ($ pkeshi, $ pmonth, $ pday )";
Mysql_query ("set names 'utf8 '");
If (! Mysql_query ($ SQL, $ con ))
{
Die ("Error:". mysql_error ());
}
Mysql_close ($ con );

?>

PHP database MySQL jquery

Share:


------ Solution --------------------
$ SQL = "INSERT INTO orderlist (keshi, month, day) VALUES ('$ pkeshi', '$ pmonth',' $ pday ')";

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.