Php pdo查询已在本地主机上成功运行,但未在主机上运行
下面是我的代码,它正在本地主机上成功运行,但未在托管服务器上运行。我试了很多次来解决这个问题,但都没能解决Php pdo查询已在本地主机上成功运行,但未在主机上运行,php,pdo,Php,Pdo,下面是我的代码,它正在本地主机上成功运行,但未在托管服务器上运行。我试了很多次来解决这个问题,但都没能解决 <?php include ('dbconfig.php'); $page = isset($_GET['p'])?$_GET['p']:''; if($page =='add'){ $email_id = $_POST['email_id']; $customer_name = $_POST['customer_name']; $mobile_n
<?php
include ('dbconfig.php');
$page = isset($_GET['p'])?$_GET['p']:'';
if($page =='add'){
$email_id = $_POST['email_id'];
$customer_name = $_POST['customer_name'];
$mobile_no = $_POST['mobile_no'];
$address = $_POST['adress'];
$city = $_POST['city'];
$state = $_POST['state'];
$country = $_POST['country'];
$no_of_jurney_person = $_POST['no_of_jurney_person'];
$j_from = $_POST['j_from'];
$j_to = $_POST['j_to'];
$date_of_jurney = $_POST['date_of_jurney'];
$return_date = $_POST['return_date'];
$stmt=$DBcon->prepare("insert into anil values('',?,?,?,?,?,?,?,?,?,?,?,?)");
$stmt->bindParam(1,$email_id);
$stmt->bindParam(2,$customer_name);
$stmt->bindParam(3,$mobile_no);
$stmt->bindParam(4,$address);
$stmt->bindParam(5,$city);
$stmt->bindParam(6,$state);
$stmt->bindParam(7,$country);
$stmt->bindParam(8,$no_of_jurney_person);
$stmt->bindParam(9,$j_from);
$stmt->bindParam(10,$j_to);
$stmt->bindParam(11,$date_of_jurney);
$stmt->bindParam(12,$return_date);
if($stmt->execute()){
echo "Mr. Or Mrs ".$customer_name;
echo "Thanks for inquiry. Our representative will call you soon";
}
else{
echo "Something went wrong. Please try again later";
}
您是否检查了数据库凭据?它们是最新的吗?还可以使用errorInfo
函数获取错误描述。还可以检查错误日志。我还检查错误bur error is 0000Add PDO::ATTR_ERRMODE=>PDO::ERRMODE_异常到PDO连接选项中,以查看错误。