get data from csvdata table how I show branch_name instead of branch_code
<p>I have two tables in a database, i) csvdata, ii)dc_master.
In csvdata table I have some column, as : id ,date, branch_code , A, B, C, D, E, F.
In dc_master table I have three column as: id, branch_code, branch_name
 When get data from csvdata table how I show branch_name instead of branch_code.</p>

<p>Page image link : <a href="https://www.dropbox.com/s/zn40pjjai4g92m5/aa.jpg" rel="nofollow">https://www.dropbox.com/s/zn40pjjai4g92m5/aa.jpg</a></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;CVS Edit&lt;/title&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;link type="text/css" href="calendar/ui-lightness/jquery-ui-1.8.23.custom.css" rel="stylesheet" /&gt;
        &lt;script type="text/javascript" src="calendar/jquery-1.8.0.min.js"&gt;&lt;/script&gt;
        &lt;script type="text/javascript" src="calendar/jquery-ui-1.8.23.custom.min.js"&gt;&lt;/script&gt;
        &lt;script type="text/javascript"&gt;
        $(function(){
    var pickerOpts = {
        dateFormat: $.datepicker.ATOM

    };  
    $("#date").datepicker(pickerOpts);

});

        &lt;/script&gt;
        &lt;style type="text/css"&gt;
&lt;!--
.style11 {font-size: 12px}
.style12 {
    color: #CCCCCC;
    font-size: 14px;
    font-weight: bold;
    font-family: Arial, Helvetica, sans-serif;
}
--&gt;
        &lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="date_container"&gt;
&lt;form action="cvs.php" method="post" name="date" id="calender" &gt;
  Select a date &amp;nbsp;
  &lt;input name="date2" type="text" id="date" class="required"  /&gt;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input name="Submit" type="submit" class="submit_button" value="Search" /&gt;
&lt;/form&gt;
&lt;/div&gt;

&lt;div id="cvsdata"&gt;
&lt;?php
@$date=$_POST['date2'];

// update data in mysql database

$result = mysql_query("SELECT * FROM csvdata where activity_date like'$date %'ORDER BY `csvdata`.`branch_code` ASC");
$numrows = mysql_num_rows($result);

?&gt;
&lt;table width="1456" border="1" cellpadding="2" cellspacing="0" id="list"&gt;
&lt;tr&gt;
&lt;td colspan="18"&gt;&lt;div align="center" class="style3 style11 style11"&gt;List of Branches  &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td width="81" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Date&lt;/span&gt;&lt;/td&gt;
&lt;td width="70" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Branch Code&lt;/span&gt;&lt;/td&gt;
&lt;td width="74" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Centre&lt;/span&gt;&lt;/td&gt;
&lt;td width="81" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Cash in Hand&lt;/span&gt;&lt;/td&gt;
&lt;td width="64" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Cash at Bank&lt;/span&gt;&lt;/td&gt;
&lt;td width="69" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Member Admitted&lt;/span&gt;&lt;/td&gt;
&lt;td width="68" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Total Member&lt;/span&gt;&lt;/td&gt;
&lt;td width="72" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Total Borrowers&lt;/span&gt;&lt;/td&gt;
&lt;td width="80" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Today Loan Disbursement&lt;/span&gt;&lt;/td&gt;
&lt;td width="74" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Total Loan Outstanding&lt;/span&gt;&lt;/td&gt;
&lt;td width="72" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Today Saving Withdrawn&lt;/span&gt;&lt;/td&gt;
&lt;td width="68" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Total Saving Balance&lt;/span&gt;&lt;/td&gt;
&lt;td width="69" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Total Overdue Member&lt;/span&gt;&lt;/td&gt;
&lt;td width="69" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Total Overdue Amount&lt;/span&gt;&lt;/td&gt;
&lt;td width="75" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Head Office Transaction (+)&lt;/span&gt;&lt;/td&gt;
&lt;td width="75" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Head Office Transaction (-)&lt;/span&gt;&lt;/td&gt;
&lt;td width="60" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Edit&lt;/span&gt;&lt;/td&gt;
&lt;td width="72" align="center" class="style4"&gt;&lt;span class="style4 style11 style11"&gt;Delete&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;?php
if ($numrows != 0){

while($rows=mysql_fetch_array($result)){
$date='activity_date';


//@$result = mysql_query("SELECT dc_name FROM dc_master where branch_code='001'");
//  while($row = mysql_fetch_array($result))
//  {$centre=$row['dc_name'];}


?&gt;

&lt;tr&gt;
&lt;td height="28" class="readonly"&gt;&lt;div align="center" class="style3 style11 style11"&gt;&lt;?php echo $rows["$date"]; ?&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td class="readonly"&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['branch_code']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="readonly"&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['branch_code']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['A']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['B']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['C']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['D']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['E']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['F']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['G']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['H']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['I']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['J']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['K']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['L']; ?&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="style3 style11 style11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;?php echo $rows['M']; ?&gt;&lt;/span&gt;&lt;/td&gt;



&lt;!--link to update.php and send value of id --&gt;
&lt;td align="center" class="readonly"&gt;&lt;a href="cvsedit.php?id=&lt;?php echo $rows['id']; ?&gt;" class="style3 style5 style5 style11 style11"&gt;Edit&lt;/a&gt;&lt;/td&gt;
&lt;td align="center" class="readonly"&gt;&lt;a href="delete_cvs.php?id=&lt;?php echo $rows['id']; ?&gt;" class="style3 style5 style5 style11 style11" onclick="return confirm('Are you sure, you want to delete? (After delete you can not undo or get it again) &lt;?php ?&gt;')"&gt;Delete&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;?php
}
}
else {?&gt;

&lt;tr&gt;&lt;td colspan="18"&gt;&lt;div align="center" class="style3 style11 style11"&gt;No record found, Please enter a valid date&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; 
&lt;?php }?&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;span class="style6 style12"&gt;Programmer : Prasanta Baidya / Mobile : 09830980840 / Email id : pbdigit@gmail.com&lt;/span&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
