任何人都可以帮助我...我想按名称或协议编号搜索,但它不起作用,它只能按名称搜索,
我是计算机编程的绝对初学者,当我想按协议编号搜索时,它只显示我数据库的第一条记录,并且只按名称搜索效果很好,
'
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)
?>
'