<?
if(isset($_POST[temp])){
//echo "555";
$sql = "SELECT title AS A1,title_detail AS A2 FROM tb_article WHERE title like '%$_POST[seach]%'
UNION
SELECT title AS A3,title_detail AS A4 FROM tb_journal WHERE title like '%$_POST[seach]%'";
//print $sql."<br>";
$result = mysql_query($sql);
while($rs=mysql_fetch_assoc($result)){
if($rs[A1]!=""){
echo "<a href=\"a1\">art</a><br>";
}else if($rs[A3]!=""){
echo "<a href=\"a2\">art</a>";
}
//echo $rs[A1]."<br>";
}
}
?>
<?
if(isset($_POST[temp])){
//echo "555";
$sql = "SELECT title AS A1,title_detail AS A2 FROM tb_article WHERE title like '%$_POST[seach]%'
UNION
SELECT j.title AS A3,j.title_detail AS A4 FROM tb_journal as j WHERE title like '%$_POST[seach]%'";
print $sql."<br>";
$result = mysql_query($sql);
while($rs=mysql_fetch_assoc($result)){
/*if($rs[A1]!="" && $rs[A3]!=""){
echo "1<a href=\"a1\">art</a><br>";
echo "2<a href=\"a2\">art</a><br>";
}else if($rs[A1]!=""){
echo "<a href=\"a1\">art</a>";
}else if($rs[A3]!=""){
echo "<a href=\"a2\">art</a>";
}*/
echo $rs[A3]."<br>";
}
}
?>