If you have any questions about data insertion in the php database, you cannot insert the data.

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;
At the end of this post, hipyaohop edited the jquery code at 10:12:39:
$ (". 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 shared:
------ 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.