I have two tables which I need to select all rows from where the userid is $userid then sort them. I tried to use join but I couldn't even really get started on how to get it right. Can anybody point me in the right direction as to how to make these into 1 query?
$result1 = mysql_query("SELECT * FROM paypal_sub_info
WHERE userid='$THEuserid' ORDER BY cur_time DESC");
$result2 = mysql_query("SELECT * FROM paypal_pay_info
WHERE userid='$THEuserid' ORDER BY cur_time DESC");
while($row = mysql_fetch_array($result1)){
echo $row['txn_type'];
}
Solution:
SELECT *
FROM paypal_sub_info sub,paypal_pay_info pay
WHERE pay.userid = '$THEuserid'
AND sub.userid = '$THEuserid'
ORDER BY pay.cur_time DESC,sub.cur_time DESC
Thanks for the help!