Anyone can help me... I want to search by name or agreementNum but it doesn't work, it only searches by name,
I'm an absolute beginner to computer programming, when I want to search by agreement number it shows only the first record of my database, and only search by name work good,
'
     mysql_select_db("aruba", $con);
        $a1=$_POST['u_Name'];
         $a2=$_POST['u_Agreement'];
         $sql=" SELECT * FROM customer
            WHERE Name like ('%$a1%') 
            OR AgreementNum ='$a2'
                 ";
         $q=mysql_query($sql);
           $x=mysql_fetch_array($q);
          ?>
        $q=mysql_query($sql);
           $x=mysql_fetch_array($q);
        ?><table>
        <tr><td><b>Customer Name:</b></td><td><?php echo" " ,$x['Name'];
         ?></td><?php
          ?><tr><td><b>Address:</b></td><td><?php echo"", $x['Address'];
          ?></td><?php
            ?><tr><td><b>Contact Person:</b></td><td><?php echo"             " ,$x['Sales'];
           ?></td><?php
           ?><tr><td><b>Phone Number: </b></td><td><?php echo"           ", $x['PhoneNum'];
         ?></td><?php
            ?><tr><td><b>Maintenance Agreement No:</b></td><td><?php echo"             "                 ,$x['AgreementNum'];
       ?></td><?php   
        ?><tr><td><b>Start Date:</b></td><td><?php echo"          " ,$x['StartDate'];
         ?></td><?php 
        ?><tr><td><b>End Date: :</b></td><td><?php echo"      " ,$x['EndDate'];
      ?></td><?php 
          ?><tr><td><b>Reseller Name:</b></td><td><?php echo" " ,$x['Reseller'];
         ?></td><?php 
          ?><tr><td><b>Product Model:</b></td><td><?php echo"      " ,$x['ModelNum'];
        ?></td><?php 
         ?><tr><td><b>Remarks:</b></td><td><?php echo" " ,$x['Quantity'];
        ?></td><?php 
        mysql_close($con)
         ?>
       '
 
     
    