output join query

Discussion in 'PHP' started by liam_d, Apr 9, 2008.

  1. #1
    Hi all, i have this query i need to echo out all the contents in a loop:

    SELECT 
        n.poster_id,
        n.date,
        n.subject,
        n.post,
        m.mid,
        m.username 
    FROM 
        news n INNER JOIN  members m ON n.poster_id = m.mid
    ORDER BY 
        n.nid DESC 
    LIMIT 6
    Code (markup):
    Although my while loop using a mysql_fetch_array gives this error:

    What is the correct way to loop through the data of a joined sql statement? And then echo it out?
     
    liam_d, Apr 9, 2008 IP
  2. m0nkeymafia

    m0nkeymafia Well-Known Member

    Messages:
    399
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    125
    #2
    Either there is an error in the query [if so output mysql_error()] or you are passing mysql_fetch_array the wrong resource.

    Paste your code so we can help.
    Thanks.
     
    m0nkeymafia, Apr 9, 2008 IP
  3. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #3
    you have not posted the code where the error is coming

    In order to help you out please post code


    Regards

    Alex
     
    kmap, Apr 9, 2008 IP