Check in other table

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Check in other table

    PHP Code:
    echo "<br/>New Picture<br/>";
        
    $nsql "SELECT pid, aid, name FROM ibwf_albumpic WHERE aid='"$prch[0]"' ORDER BY time DESC LIMIT 1";
        
    $news mysql_query($nsql);
        echo 
    mysql_error();  
        if(
    mysql_num_rows($news)>0)
        {
        while (
    $new mysql_fetch_array($news))
        {
                    echo 
    "<a href=\"album.php?action=pix&amp;pid=$new[0]\"><img src=\"../image.php?pid=$new[0]&s=50\"/></a><br/>";
                    echo 
    "<a href=\"album.php?action=pix&amp;pid=$new[0]\">$new[2]</a><br/>";
        }
        } 

    i just want to take all pid in ibwf_albumpic but if aid of ibwf_albumpic is private=1 in aid of ibwf_album then that is not taken, but i dont have private in ibwf_albumpic

    `ibwf_album` (`aid`, `uid`, `album`, `private`)
    `ibwf_albumpic` (`pid`, `uid`, `aid`, `name`, `file`, `caption`, `time`)

    they only have same in uid and aid

    is this possible?
    Last edited by kei_ki7; 03.02.10, 22:12.
    Did I help you?
    You can help me too
    Your donations will help me finance my studies.

    #2
    aid is the pid from the ibwf_album ryt? try..
    Code:
    SELECT private FROM ibwf_album WHERE pid='aid'

    Comment


      #3
      Originally posted by thanatos View Post
      aid is the pid from the ibwf_album ryt? try..
      Code:
      SELECT private FROM ibwf_album WHERE pid='aid'
      thanks, but im sorry, i didnt get where to put that
      Did I help you?
      You can help me too
      Your donations will help me finance my studies.

      Comment


        #4
        `ibwf_album` (`aid`, `uid`, `album`, `private`)
        `ibwf_albumpic` (`pid`, `uid`, `aid`, `name`, `file`, `caption`, `time`)

        aid of ibwf_album = aid of ibwf_albumpic

        i want to take all pid in ibwf_albumpic but if aid of ibwf_albumpic is private=1 in aid of ibwf_album then that is not taken

        is that possible?

        its like select pid from ibwf_albumpic where aid and private=0
        but my problem is the private checker is in ibwf_album

        i thought i saw somewhere using something like this

        select pid from ibwf_albumpic where (select pid from ibwf_album where aid and private=0)

        i just cnt remember

        im sorry, i will edit the 1st post
        Last edited by kei_ki7; 03.02.10, 22:17.
        Did I help you?
        You can help me too
        Your donations will help me finance my studies.

        Comment


          #5
          Code:
          $nsql =mysql_query(mysql_fetch_array("SELECT pid, name FROM ibwf_albumpic WHERE aid='".$prch[0]."' ORDER BY time DESC LIMIT 1"); $priv8 = mysql_query(mysql_fetch_array("SELECT private FROM ibwf_album WHERE pid='".$prch[0]."'"); if($priv8[0]=='1'){ $show = "<img src=\"images/offlimits.jpg\"/>"; }else{ $show = "<img src=\"img.php?pid=$new[0]\"/>"; } echo $show;
          Last edited by thanatos; 04.02.10, 09:05.

          Comment


            #6
            select pid from ibwf_albumpic where (select pid from album where aid and private=0)
            i dnt knw hw 2 put it dat way.. bt u cn search gugel if u wnt ur query dat way..

            Comment


              #7
              thanks again thana :D i will try this asap

              btw im planning to change my query if i cannot make this work
              Did I help you?
              You can help me too
              Your donations will help me finance my studies.

              Comment


                #8
                thanks thana for your time and replies

                PHP Code:
                $nsql "SELECT pid, aid, name FROM ibwf_albumpic WHERE aid = ANY (SELECT aid FROM ibwf_album WHERE private=0) ORDER BY time DESC LIMIT 1"
                i use this and its works
                Did I help you?
                You can help me too
                Your donations will help me finance my studies.

                Comment


                  #9
                  ur welcome..

                  Comment

                  Working...
                  X