I am working with PHP and MYSQL database . I am getting an error mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\hp_gas\update.php on line 12 .
I am attaching my PHP code.
<?php
$host = 'localhost';
$username = 'root';
$pass = '';
$db = 'tutorial';
$conn = new mysqli($host,$username,$pass,$db);
$id=$_GET['id'];
$result = mysqli_query($conn,"SELECT from added_date Where id=$id");
while($res=mysqli_fetch_array($result)){
$issuedate = $res['i_date'];
}
?>
HTML form code -
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
if (isset($_POST['submit'])) {
$id = $_POST['id'];
$issuedate = $_POST['issuedate'];
$result = mysqli_query($conn, "UPDATE added_date set i_date='$issuedate' WHERE id=$id");
echo "Updated";
} else{
echo "Sorry";
}
?>
<form method="post" action="">
<label>Issue Date</label>
<input type="date" name="issuedate" id="issuedate" class="form-control" value="<?php echo $issuedate; ?>">
<br>
<input type="hidden" name="id" value=<?php echo $_GET['id']; ?>>
<input type="submit" name="submit">
</form>
</body>
</html>
I am updating data using PHP and MYSQL database but getting error like mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool is given.
How can I fix this error in PHP?