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 ')";