Database table I want to check a column value of a table is not equal to zero in php .But it gives error on column name "Undefined index". Please guide me what is problem with my code.My php code is given below
<?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);
}
?>