View Single Post
Old 01-23-2012, 02:39 PM  
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
Mysql / php query question.

I'm collecting data from 3 tables, of which one of the tables (social_meminfo) has multiple rows for results. How can I isolate the results of social_meminfo identifying each rows results? Or should I use two separate queries? At there should be at least two rows that would be found. Also instead of using `$en['m'.$key]` I want to use `$en['b'.$key]`

Code:
        $res = mysql_query("SELECT *, DATE_FORMAT(sm.m_lld,'%m/%d/%y') 
                            AS m_lld_formatted 
                            FROM social_members sm
                            JOIN social_meminfo smi ON (sm.m_id = smi.m_id)
                            LEFT OUTER JOIN social_memtext smt ON (sm.m_id = smt.m_id)
                            WHERE sm.m_user = '".mysql_real_escape_string($en['user'])."'");            
        if (mysql_num_rows($res) == 0) call404();
    #while ($line = mysql_fetch_assoc($res)) {
        $line = mysql_fetch_assoc($res);
        foreach ($line as $key => $value) {
                $en['m'.$key] = str_replace("\n",'<br/>',stripslashes($value));
                }
or should I just use two queries and a while statement?
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote