PHP Database Insert data about the problem, die or die in, ask God guidance

Source: Internet
Author: User
Tags php database
PHP Database Insert data problem, die or die plug in, seek the guidance of the Great God
This post was last edited by Hipyaohop on 2013-06-28 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 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);

?>
PHP Database MySQL jquery

Share to:


------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.