View Single Post
Old 01-24-2012, 08:52 AM  
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 25,038
Quote:
Originally Posted by acctman View Post
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?
All that code gives me a headache, I am a relative novice at this stuff.

I know you are trying to refine and use best coding practice and all that stuff, but unless this is a job for someone else or for a site with MASSIVE traffic why worry so much?

Use 2 or more queries - any modern server could handle it...
__________________
-

Chaturbate Script - https://gfy.com/fucking-around-and-b...er-issues.html - Now supports White Labels
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote