Hi Everyone
I have a webform, from which i want records should be submitted into two tables under same database name.
My code is
<?php
$con = mysql_connect("localhost","************","***********");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db=mysql_select_db("qserves1_uksurvey", $con);
$sql="INSERT INTO forms (date, Receivingsky, Title, Firstname, Lastname, House, Street, Town, County, Postcode, Number, WarrantyCoverForSky, Tvmake, Warrantycover, Payingmonthly, Agentnotes, Agentname)
VALUES
(NOW(),'$_POST[Receivingsky]','$_POST[Title]','$_POST[Firstname]','$_POST[Lastname]','$_POST[House]','$_POST[Street]','$_POST[Town]','$_POST[County]','$_POST[Postcode]','$_POST[Number]','$_POST[WarrantyCoverForSky]','$_POST[Tvmake]','$_POST[Warrantycover]','$_POST[Payingmonthly]','$_POST[Agentnotes]','$_POST[Agentname]')";
$sql_result = mysql_query($sql, $con) or die (mysql_error());
$con2 = mysql_connect("localhost","*******8","*********8");
if (!$con2)
{
die('Could not connect: ' . mysql_error());
}
$db2=mysql_select_db("qserves1_uksurvey", $con2);
$sql2="INSERT INTO dupphones (date, Number)
Values
(NOW(),'$_POST[Number]')";
$sql_result = mysql_query($sql2, $con2) or die (mysql_error());
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo '<html>
<head>
<title>Lead Submitted successfully!!!</title>
</head>
<body>
<center>
<strong><a href="http://q2serves.com/uksurvey.html">Lead Submitted ---- Click Here To Enter New Lead</a></strong>
</center>
</body>
</html>!';
mysql_close($con)
?>
This is submitting 3 leads 1 is in table dupphones and 2 leads in table forms.
I want this to submit 1 lead in each table only.
Please help
Thanks
Prakash ghai