我想同时执行两个查询插入和更新查询当我使用更新查询时我的插入查询不起作用但更新查询工作请帮助解决这个问题。
<?php
$con=mysqli_connect("localhost","root","","my");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "INSERT INTO `kyc`( `date`,`agentid`,`formno`, `bank`, `ptype`,
`cardno`, `cname`, `fname`, `mname`, `dob`, `phone`, `votarid`,`sex`,
`email`, `district`, `thana`)
VALUES('$date','$agentid',$formno,'$bank','$ptype','$cardno','$cname','$fname',
'$mname','$dob',$phone,$votarid,'$sex','$email','$district','$thana')";
$sql="UPDATE card SET status='1'WHERE $cardno=`cardno`";
$result = mysqli_query($con,$sql);
echo "One raw Successfully inserted";
mysqli_close($con);
}
?>