Database table 我想检查一个表的列值在php中不等于零。但它在列名“未定义的索引”上给出了错误。请指导我的代码有什么问题。我的PHP代码如下所示
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
require_once('dbConnect.php');
$paydue=$_POST['paydue'];
$rid=$_POST['rid'];
$cardid = $_POST['cardid'];
$sq = "SELECT * FROM bill WHERE refid='".$rid."'";
$query=mysqli_query($con,$sq);
$result=mysqli_fetch_row($query);
if($result["paydue"] != '0'){
$sql = "SELECT * FROM account WHERE cardid='".$cardid."'";
$query1=mysqli_query($con,$sql);
$result1=mysqli_fetch_row($query1);
$sql1="UPDATE account SET balance = (balance - $paydue) WHERE cardid='$cardid';";
if(mysqli_query($con,$sql1)){
echo 'Payed Successfully';
$sql2="Update bill set paydue = (paydue - $paydue) where refid='$rid';";
mysqli_query($con,$sql2);
}else{
echo 'Could Not Payed Try Again';
}
}else{
echo 'your Bill already Payed';
}
//closing connection
mysqli_close($con);
}
?>