<?php
include 'connection.php';
if(isset($_POST['id']))
{
$name=trim($_POST['id']);


$query31=mysql_query("SELECT * FROM customer_master WHERE customer_name LIKE '%$name%'");
 $num_rows = mysql_num_rows($query31);
//echo $query31;


$query12=mysql_query("SELECT * FROM third_customer_master WHERE party_name LIKE '%$name%'");
//echo $query12;

//$query3=mysql_query("SELECT * FROM customer_master WHERE customer_name LIKE '%$name%' or mobile_no LIKE '%$name%' or email_id LIKE '%$name%'");
 $num_rows1 = mysql_num_rows($query12); 
 
if($num_rows1=='0' and $num_rows=='0')

{ 


?>
<table style="border-collapse:collapse; width:100%; border-radius:3px 3px 3px 3px">
  <tr>
    <td colspan="5" bgcolor="#fff">
	<div align="left" style="padding:2px;" onclick='fill1("<?php echo 'NEW' ?>")'><font color="#FF0000">New Customer Name </font><font color="#000000">(Record Not Found)</font></div>
	</td>
  </tr></table><? } else { ?>
  
  <? 
  while($query3=mysql_fetch_array($query12))
{

  ?>
  <table style="border-collapse:collapse; width:100%; border-radius:3px 3px 3px 3px" bgcolor="#fff">
  <tr>
    <td colspan="5" bgcolor="#fff">
	<? if($num_rows1!='0')

{ 
?>
	<input type="hidden" name="contact_id" value="a" />
	<? }?>
	
	<div align="left" style="padding:2px;" onclick='fill1("<?php echo $query3['sub_id']; ?>@<?php echo "3rd Party"; ?>")'><font color="#000000"> <strong><?php echo $query3['party_name']; ?> </strong>&nbsp;&nbsp; </font></div>
	</td>
  </tr>


 
</table><? } ?>

<? 
while($query3=mysql_fetch_array($query31))
{
?>


<table style="border-collapse:collapse; width:100%; border-radius:3px 3px 3px 3px" bgcolor="#fff">
  <tr>
    <td colspan="5" bgcolor="#fff">
	<div align="left" style="padding:2px;" onclick='fill1("<?php echo $query3['id']; ?>")'><font color="#000000"><strong><?php echo $query3['customer_name']; ?> </strong>&nbsp;&nbsp;  </font></div>
	</td>
  </tr>
 
</table>
<br />
<?php
}
}
}
?>
