Hi,

I have a messages table and a friends table and I am using the following queriers to display the number of messages and buddy requests for the user that is currently logged in.

Since the userid is the same in the where clause in both queries should they be joined? I can join basic tables but I’m not sure how to join these tables correctly, can anyone show me how they would do it?

Any help will be appreciated :)

PHP Code:


<?
// Get number of messages
$messagesNummysql_num_rows(mysql_query(“SELECT userto FROM messages WHERE userto = ’$_SESSION[userid]’ and status=’unread’”));
 
// Get number of friend requests
$buddyrequestsmysql_num_rows(mysql_query(“SELECT * FROM friends WHERE friend1=’$_SESSION[userid]’ and status=’pending’”));


30,000 Mb And Unlimited Bandwidth Only $3.75/mo.


Go Daddy  $6.95 .com sale 468x60

Powered By: BigInfo.org