Probleme bei der Suchfunktion!

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • #16
    PHP-Code:
    <?
    include ("dbconnect.php");
    $eintraege=explode("|",$zusammenfassung);

    for ($x=0;$x<count($eintraege);$x++)
    {   
         $AND .= " AND catchword.name like '".$eintraege[$x]."' ";}
        $sql = mysql_query("SELECT * FROM catchword 
    LEFT JOIN file ON catchword.file_id=file.id WHERE catchword.file_id<>1 ".$AND);
        
          while($row = mysql_fetch_object($sql))
        {
            echo"<a href='picture/$row->name'>
    <img src=\"thumbs/$row->name\" border='1'> <br></a>";        
          }

    ?>
    hoff jetzt passt es!
    Zuletzt geändert von Dönerman; 12.10.2005, 13:14.
    YOOO!! hunger!!

    Kommentar


    • #17
      du führst die query immer noch in der schleife aus!

      Kommentar


      • #18
        habs editiert sorry! er gibt mir nix aus!
        YOOO!! hunger!!

        Kommentar


        • #19
          was hast du editiert? ich sehe immer noch, wie du die query in der schleife ausführst.

          Kommentar


          • #20
            PHP-Code:
            <?
            include ("dbconnect.php");
             $eintraege=explode("|",$zusammenfassung);
            for ($x=0;$x<count($eintraege);$x++)
            {   
                $AND .= " AND catchword.name like '".$eintraege[$x]."' ";
            }
            if($eintraege[$x] !=""){
                
                $sql = mysql_query("SELECT * FROM catchword 
            LEFT JOIN file ON catchword.file_id=file.id WHERE
            catchword.file_id<>1 ".$AND);
                  while($row = mysql_fetch_object($sql))
                {    
                    echo $row->name;
                  }


            ?>
            er gibt mir nix aus!
            Zuletzt geändert von Dönerman; 12.10.2005, 13:21.
            YOOO!! hunger!!

            Kommentar


            • #21
              die if-abfrage dagegen gehört in die schleife.

              ich hab das gefühl, dass du aus dem bauch heraus "codest", ohne wirklich zu verstehen, was du da machst.

              Kommentar


              • #22
                es ist wurscht obs sie draußen ist oder nicht, weil ich sowieso nix sehe!

                ich weiß sie gehört hinein, weil sonst bekommt er [$x] nicht!
                Übersehen!

                ICH SEHE NIXXXX!!
                YOOO!! hunger!!

                Kommentar


                • #23
                  1. belege $AND am anfang der datei mit null oder so.
                  2. mach das E_ALL an (das sage ich dir auch nicht zum ersten mal).
                  3. benutze mysql_error()

                  erst wenn du alle 3 punkte erfüllt hast, zeigst du hier deinen aktuellen code und hörst auf, schwachsinnige "geht nichts, alles versucht!" posts von dir zu geben.

                  Kommentar


                  • #24
                    was ist E_ALL??
                    YOOO!! hunger!!

                    Kommentar


                    • #25
                      das ist der code:

                      PHP-Code:
                       $eintraege=explode("|",$zusammenfassung);
                       
                      $AND '0';
                      for (
                      $x=0;$x<count($eintraege);$x++)
                      {   
                          
                      $AND .= " AND catchword.name like '".$eintraege[$x]."' ";
                      }
                          
                          
                      $sql mysql_query("SELECT * FROM catchword LEFT 
                      JOIN file OR catchword.file_id=file.id WHERE catchword.file_id<>1 "
                      .$AND);
                            while(
                      $row mysql_fetch_object($sql))
                          {   
                          echo 
                      $row->name;
                          }

                      echo 
                      mysql_error(); 
                      und das bekomme ich:

                      Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\banp\admin1\search_1_admin1.php on line 11
                      You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR catchword.file_id=file.id WHERE catchword.file_id<>1 0 AND c
                      YOOO!! hunger!!

                      Kommentar


                      • #26
                        PHP-Code:
                        $AND null

                        Kommentar


                        • #27
                          ändert auch nix!

                          Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\banp\admin1\search_1_admin1.php on line 10
                          You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR catchword.file_id=file.id WHERE catchword.file_id<>1 AND ca
                          YOOO!! hunger!!

                          Kommentar


                          • #28
                            du hast immer noch nicht verstanden, was ich dir 2 posts höher gesagt habe. lies dir in ruhe http://www.php-resource.de/forum/sho...threadid=50454 durch.

                            Kommentar


                            • #29
                              PHP-Code:
                              echo mysql_error()."<br>";
                              echo 
                              error_reporting(E_ALL); 

                              Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\banp\admin1\search_1_admin1.php on line 10
                              You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR catchword.file_id=file.id WHERE catchword.file_id<>1 AND ca
                              2039
                              YOOO!! hunger!!

                              Kommentar


                              • #30
                                so jetzt habe ich:

                                PHP-Code:

                                 $eintraege
                                =explode("|",$zusammenfassung);
                                 
                                $AND null;
                                 
                                for (
                                $x=0;$x<count($eintraege);$x++)
                                {   
                                    
                                $sql mysql_query("SELECT * FROM catchword where 
                                name = '
                                $eintraege[$x]'");
                                      while(
                                $row mysql_fetch_object($sql))
                                    {   
                                    
                                $sqal mysql_query("SELECT * FROM file where id = 
                                '
                                $row->file_id'");
                                      while(
                                $row mysql_fetch_object($sqal))
                                    {   
                                      echo
                                "<a href='picture/$row->name'>
                                <img src=\"thumbs/
                                $row->name\" border='0'></a>";

                                    }
                                    }
                                    

                                wie mache ich das jetzt das die einträge nur max. einmal vorkommen?
                                YOOO!! hunger!!

                                Kommentar

                                Lädt...
                                X