Please Login or Register to continue.


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.  


$host = 'localhost';

$username = 'root';

$pass = '';

$db = 'tutorial';

$conn = new mysqli($host,$username,$pass,$db);


$result = mysqli_query($conn,"SELECT from added_date Where id=$id");


$issuedate = $res['i_date'];



HTML form code -

<!DOCTYPE html>







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; ?>">


          <input type="hidden" name="id" value=<?php echo $_GET['id']; ?>>

          <input type="submit" name="submit">





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? 


(180 Points)
in PHP


3 Answers
(7.3K Points)

I have checked your code. You are working for update operation in PHP with an MYSQL database. You have many issues in your code. As I can see, you are getting "mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in ". This happens when you did a mistake in your connection file or query. Your MySQL query looks good but the connection is not well. 

I am removing issues from your PHP code.  

$host = 'localhost';
$username = 'root';
$pass = ' ';
$db = 'tutorial';
$conn = mysqli_connect($host,$username,$pass,$db);

Kindly check these PHP lines and update your code.

You can learn from the tutorial - Update operation in PHP with  MYSQL database



(9.3K Points)

You are missing PHP mysqli_connect() function and syntax error in connection code. You have used a new keyword with mysqli. First, of understanding the error "mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool is given" This error shows that the variable values are not coming or something missing in your MYSQL query, connection variable. Make sure to update these two lines - 

$pass = ' ';

and the next line. 

$conn = mysqli_connect($host,$username,$pass,$db);

No need to use the NEW keyword. 

Kindly check all syntaxes, functions, and query before the mysqli_fetch_array() function. 


(7.3K Points)

As you can see, I have answered the above. One more line has an issue in your PHP code. 

You are missing the asterisk * symbol in your PHP query. 

$result = mysqli_query($conn,"SELECT* FROM added_date WHERE id=$id");



Related Questions :-

Featured Items:-

Certificate system in PHP website | PHP scripts


Home Credito loan finance management multipurpose system in PHP


Result management system with Marksheet in PHP website | PHP Scripts


Your Answer

You can post your answer after login..