Bir deyim içinde döngü sorunu

0 Cevap php

i Birisi çığlık hakkında yardımcı olur umarım!

temelde aşağıdaki deyimi ile bir kaç şey yapmaya çalışıyorum;

First i want to check if the user id exists in member_categories_position. If it Does i want then to exclude all entries from the second statement where member_id equals all results from the first statement the third statement is the else statement that displays if the member_id is not present in the member_categories position.

SORUN - ilk sistemden sonuç, ince döngüler i (= '$ memid'!) Deneyin ve ikinci deyimi içine taktığınızda ancak hiçbir sonuç üretir ve hiçbir etkisi yoktur. Ben sorunun $ memid ilmekli sonucu olduğunu düşünüyorum.

Nasıl ikinci deyim member_categories_position olan herhangi member_id bu açıklamada gösterilmez söylemek alabilirim?

$sql2 = "
    SELECT * 
    FROM member_categories_position a 
    JOIN member_users b 
        ON b.id = a.member_id";

$rs2 = mysql_query($sql2);
while ($row = mysql_fetch_array($rs2))
{
    $memid = "".$row['member_id']."";   
}

if(mysql_num_rows($rs2) != 0)
{
    $new= "
        SELECT * 
        FROM member_categories 
        JOIN member_users 
            ON member_categories.member_id=member_users.id 
        JOIN member_config 
            ON member_categories.member_id=member_config.member_id 
        WHERE 
            member_categories.categories='$category' 
            AND member_categories.member_id !='$field'  
        GROUP BY member_config.member_id  
        ORDER BY RAND() limit 0,42";

    $rs = mysql_query($new);

    while ($row = mysql_fetch_assoc($rs)) 
    {
        echo "result excluding member ids from the first statement";
    }
    echo "<div class=\"clear\"></div>";
}
else
{

    $new= "
        SELECT * 
        FROM member_categories 
        JOIN member_users 
            ON member_categories.member_id=member_users.id 
        JOIN member_config 
            ON member_categories.member_id=member_config.member_id 
        WHERE
            member_categories.categories='$category' 
        GROUP BY member_config.member_id  
        ORDER BY RAND() limit 0,42";

    $rs = mysql_query($new);

    while ($row = mysql_fetch_assoc($rs)) 
    {
        echo "Result with all member ids";
    }
    echo "<div class=\"clear\"></div>";

}  } <-- (second is a stray from original post)

0 Cevap