I have got an error when i run this code.My query is updated but when I fetch the query then i got this error mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\html-contact-form-captcha\update.php on line 44

please check the code is given below:-


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<table border="1">
<th> Name</th>
<th> Active</th>

<th> Last Name</th>


echo $qry="update records set name='$name', active='$active', LastName='$lastName' where id='$id' ";



echo mysql_error();



Please solve this issue asap...thanks in advance..

My query is executed and it is working fine but when i want to print that updated records then i got that error(mysql_fetch_result).

You are running an update query, and pass the return value of mysql_query into mysql_fetch_array.
So, as per the manual text below, you pass a boolean into mysql_fetch_array, not a record set. Hence the error message.


For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.


In adittion to the ans by @jwer, what you need now is a SELECT query which will fetch data from your updated table.

thank you for your reply . I got the point and it is working fine.

use select query to get data set from your corresponding table.