This post was last edited by Hipyaohop on 2013-06-28 10:12:39
PHP Database MySQL jquery
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 are data in it, alert over.
orderinsert.php Code:
Session_Start ();
$con = mysql_connect ("localhost", "root", "MySQL");
if (! $con)
{
Die ("Could 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);
?>
Reply to discussion (solution)
$sql = "INSERT into OrderList (keshi,month,day) VALUES (' $pkeshi ', ' $pmonth ', ' $pday ')";
Thank you very much.