Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/kanak/public_html/celltopc/branchedit.php on line 38
<p>I am Creating a data edit page: It is work properly in Localhost, but when I upload in web server it's show a error and no data in my edit field when I click on edit Link. Please help.
I have no certificate or any teacher. I'm learning PHP in online.</p>

<p>my code is :</p>

<pre><code>&lt;?php include 'include/config.php';
    include 'include/opendb.php';
    include 'loginheader.php'; ?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Branch&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" media="screen" href="jqueryvalidation/demo/css/screen.css" /&gt;
&lt;script src="jqueryvalidation/jquery.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="jqueryvalidation/jquery.validate.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function() {
    $("#commentForm").validate();
});
&lt;/script&gt;
&lt;style type="text/css"&gt;
&lt;!--
body {
    background-color: #cccccc;
}
--&gt;
&lt;/style&gt;
&lt;link href="css/usercss.css" rel="stylesheet" type="text/css" /&gt;
&lt;style type="text/css"&gt;
&lt;!--
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php
    // get value of id that sent from address bar
@$id=$_GET['id'];
// Retrieve data from database
$sql="SELECT * FROM dc_master WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?&gt;


&lt;div id="container"&gt;
 &lt;table width="453" border="0" align="left" cellpadding="0" cellspacing="1"&gt;
&lt;tr&gt;
&lt;td width="451"&gt;&lt;form name="cmxform" id="commentForm" method="post" action="update.php"&gt;
&lt;table width="100%" border="0" cellspacing="1" cellpadding="3"&gt;
&lt;tr&gt;
&lt;td colspan="3"&gt;&lt;span class="style2"&gt;Update Branch into Database &lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="100" height="46"&gt;Branch Code&lt;/td&gt;
&lt;td width="18"&gt;:&lt;/td&gt;
&lt;td width="309"&gt;&lt;input name="branch_code" type="text" id="branch_code"  minlength="3" class="required" value="&lt;?php echo $rows['branch_code']; ?&gt;"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height="51"&gt;Branch Name&lt;/td&gt;
&lt;td&gt;:&lt;/td&gt;
&lt;td&gt;&lt;input name="branch_name" type="text" id="branch_name" class="required" value="&lt;?php echo $rows['dc_name']; ?&gt;" &gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;input name="id" type="hidden" id="id" value="&lt;?php echo $rows['id']; ?&gt;"&gt;
&lt;/td&gt;
  &lt;td height="47" colspan="3" align="center"&gt;

    &lt;div align="right"&gt;
      &lt;input name="Submit" type="submit" class="submit_button" value="Submit" /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; 
&lt;!--Branch List --&gt;

&lt;?php
$sql="SELECT * FROM dc_master";
$result=mysql_query($sql);
?&gt;
&lt;table width="436" border="1" cellpadding="2" cellspacing="0" class="table" id="list"&gt;
&lt;tr&gt;
&lt;td colspan="4"&gt;&lt;div align="center"&gt;&lt;strong&gt;List of Branches &lt;/strong&gt; &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td width="87" align="center" class="style4"&gt;&lt;span class="style4"&gt;Branch Code&lt;/span&gt;&lt;/td&gt;
&lt;td width="176" align="center" class="style4"&gt;&lt;span class="style4"&gt;Branch Name&lt;/span&gt;&lt;/td&gt;
&lt;td width="70" align="center" class="style4"&gt;&lt;span class="style4"&gt;Edit&lt;/span&gt;&lt;/td&gt;
&lt;td width="77" align="center" class="style4"&gt;&lt;span class="style4"&gt;Delete&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;?php
while($rows=mysql_fetch_array($result)){
?&gt;

&lt;tr&gt;
&lt;td height="28"&gt;&lt;div align="center" class="style3"&gt;&lt;?php echo $rows['branch_code']; ?&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['dc_name']; ?&gt;&lt;/span&gt;&lt;/td&gt;

&lt;!--link to update.php and send value of id --&gt;
&lt;td align="center"&gt;&lt;a href="branchedit.php?id=&lt;?php echo $rows['id']; ?&gt;" class="style3 style5 style5"&gt;Edit&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="delete.php?id=&lt;?php echo $rows['id']; ?&gt;" class="style3 style5 style5" onclick="return confirm('Are you sure you want to delete?&lt;?php ?&gt;')"&gt;Delete&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;?php
}
?&gt;
&lt;/table&gt;


&lt;?php
mysql_close();
?&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;  
</code></pre>
