Page 1 of 1
selecting multiple data with query
Posted: Tue May 11, 2004 9:27 pm
by HaVoC
Code: Select all
<?php
$query = "SELECT * FROM ldu_messanger WHERE message_to = '".$to."' AND message_from = '".$from."' AND message_to = '".$from."' AND message_from = '".$to."' ORDER BY message_id ASC";
?>
That's my query there, what i'm trying to do is have it select messages the person has sent to a certain person, but also display his messages. Is there a way to get 2 different queries in a fetch array?
Posted: Wed May 12, 2004 7:35 am
by phice
Code: Select all
<?php
$query = "SELECT * FROM ldu_messanger WHERE (message_to = '".$to."' AND message_from = '".$from."') OR (message_to = '".$from."' AND message_from = '".$to."') ORDER BY message_id ASC";
?>
Posted: Wed May 12, 2004 9:13 am
by Weirdan
yep, phice has posted right solution for your problem, but regarding your exact question:
Is there a way to get 2 different queries in a fetch array?
check mysql manual:
http://dev.mysql.com/doc/mysql/en/UNION.html
Posted: Sat May 22, 2004 9:48 am
by HaVoC
Thanks a bunch!