编程论坛's Archiver

hejingke 发表于 2008-5-7 17:17

MYSQL怎么从几个结构相同的表里面查找一条记录

<?
$username=trim($_REQUEST["username"]);
$id=trim($_REQUEST["id"]);
$sql="select*from Bar_book union select*from Hotel_book union select*from Catering_book union select*from productionOther_book union select*from Company_book union select * from business_book union select * from Matchmaking_book union select * from outputOther_book union select * from Premises_book union select * from serviceOther_book where username='".$username."' and id='".$id."' order by id desc";
$resu=mysql_query($sql);
$res=mysql_fetch_array($resu);
$num=mysql_num_rows($resu);
if($res){
echo $num;
}
?>

返回的不是一个结果.江湖急救啊!

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.