This question already has an answer here:
Data Values of DatabaseWhen i run this query i got error:
$sql_unique= "Select * from scandrug WHERE exp_dt == DATE_ADD(NOW(),INTERVAL 15 DAY)";
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\qrcode\date.php on line 28
I want to select those records from my table which have 15 days left from expiry? please help
Here is full code
<?php
header('Content-type: text/plain');
$user = 'root';
$pass = '';
$con = 'pharmacy';
$con = new mysqli('127.0.0.1', $user, $pass, $con);
if(!$con)
{
echo 'Unable to Connect with Server';
}
if (!mysqli_select_db($con,'pharmacy'))
{
echo 'Database is Not Selected';
}
//select database
mysqli_select_db($con,'pharmacy');
$current_dt= date('d-m-Y');
$sql_unique= "Select * from scandrug WHERE exp_dt == DATE_ADD(NOW(),INTERVAL 15 DAY)";
$result = mysqli_query($con,$sql_unique);
while($row = mysqli_fetch_assoc($result))
{
echo $row['name'];
echo $row['batch_no'];
echo "
";
}
?>
</div>