如何在两个select语句中使用mysql_fetch_assoc,这个语句在OR运算符中给出,以选择表格表格

How to mysql_fetch_assoc array for either of select statement if either one is selected and display them ?

$query1= "SELECT name, email_id,mobile_number from tablename where `user_id='$id'"` 
            OR      
        "SELECT guser_name, guser_email from tablename1 where user_id='$id'";

if($q=mysql_query($query1))
{
    $row = mysql_fetch_assoc($q);
    $name = $row['guser_name'];
    $name1 = $row1['name'];
    $mail1 = $row1['email_id'];
    $mail= $row['guser_email'] ;
    $phone = $row1['mobile_number']

You can try something like below. This way, all rows whether coming from table1 or table2 can be accessed using same key in array obtained from mysql_fetch_assoc.

select name1 as name,email1 as email, mobile1 as mobile FROM table1 WHERE id=1
UNION ALL 
select name2 as name,email2 as email, '' as mobile FROM table2 WHERE id=1 

Demo http://sqlfiddle.com/#!2/9d81c/1