更新时间:2023-02-26 09:42:04
con = mysql_connect( localhost, root, 跨度>);
if (!
con)
{
die(' 无法连接:' .mysql_error());
}
mysql_select_db( newcrm,
CON);
below is my code written and i can insert only to one table at a time. please help me how to write code which can insert to 2 tables at a time and i am new to php my sql so please help me in details thanks friends as i get very good responses from this forum all the time.. and sorry if this question is silly as i started working on project a week age only
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("newcrm", $con);
$sql="INSERT INTO common (refno, date, agentname, zcno, callerid)
VALUES
('$_POST[refid]','$_POST[date]','$_POST[agentname]','$_POST[zcno]','$_POST[cid]')";
$sql1="INSERT INTO enquiry (refno, customername, category, comments)
VALUES
('$_POST[refid]','$_POST[cname]','$_POST[catg]','$_POST[commts]')";
if (!mysql_query($sql,$con) && !mysql_query($sql1,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con)
?>
con = mysql_connect("localhost","root",""); if (!
con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("newcrm",
con);