Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

so the query below will run in my phpmyadmin (with the variables as actual values as course), but when I run it in my php code I only get the first field returned (as if the second query after the UNION was never run).

$result=mysql_query("(SELECT RID, Name, Address, City, State, Zip_Code, Phone 
                      FROM restaurant 
                      WHERE Name = '$sql_name' AND City = '$sql_location') 
                      UNION 
                      (SELECT RID, Name, Address, City, State, Zip_Code, Phone 
                      FROM restaurant 
                      WHERE Name = '$sql_name' OR City = 'sql_location') ");

Can anyone help me as to why this is? Thanks for reading and I appreciate any and all help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
172 views
Welcome To Ask or Share your Answers For Others

1 Answer

City = 'sql_location')
        ^ missing '$' symbol

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...