View Single Post
  #2 (permalink)  
Old 2006-03-14, 03:50 PM
barand barand is offline
Member
 
Join Date: May 2003
Posts: 47
barand
Default

When you are looking up a value with one query then using that value in the WHERE clause of a second query the same result can usually be achieved with a single, joined query

Code:
$sql = "SELECT COUNT(*) as numcreds
    FROM order_ord o INNER JOIN tbl_users u
    ON o.userid_ord = u.int_user_id
    WHERE io.d_ord = '$colname_find_user' ";
$result = mysql_query($sql) or die(mysql_error());
$totalRows_old_credits = mysql_result($result, 0, 'numcreds');
__________________
Barand
Reply With Quote