Error bei mysql_fetch_array():

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

  • Error bei mysql_fetch_array():

    Guten Tag,

    bei diese folgende php habe ich folgenden fehler bekommt .

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/thomas_k/www/news/edit_process.php on line 12

    Bitte helfen Sie mir weiter....

    PHP Code:
    $id=$_GET[id];
    $abfrage "SELECT title,news FROM news WHERE id=$id";
    $ergebnis mysql_query($abfrage);
           while(
    $rows mysql_fetch_array($ergebnis))
            {
                
    $title=$rows["title"];
                
    $news=$rows["news"];
      echo 
    "<form name=\"edit_process.php\" method=\"post\" action=\"edit_save.php?id=$id\"> 
    Ich danke Ihnen Im Vorus,
    Zomi.


    EDIT:
    php.tags by Abraxax
    Last edited by zomi; 26-09-2003, 15:36.

  • #2
    1. hat der liebe gott uns php.tags gegeben, damit wir auch besser lesen können.

    2. sehe ich kein mysql_error() bei dir, womit man sql-fehler erkennen kann.
    PHP Code:
    $ergebnis mysql_query($abfrage) or die(mysql_error()); 
    3. bist du mit php im falschen forum. das ist sql. *VERSCHIEB*
    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


    Comment


    • #3
      PHP Code:
      $ergebnis mysql_query($abfrage) or die(mysql_error()); 
      You have an error in your SQL syntax near '' at line 1

      was könnte meine Fehler sein???
      Last edited by zomi; 26-09-2003, 15:47.

      Comment


      • #4
        Original geschrieben von zomi
        was könnte meine Fehler sein???
        k.a. meine glaskugel habe ich nicht bei mir.

        PHP Code:
        $abfrage "SELECT title,news FROM news WHERE id=$id";
        echo 
        '<pre>';
        echo 
        $abfrage;
        echo 
        '</pre>'
        ausgabe?
        INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


        Comment


        • #5
          bei mir dei Ausgabe ist
          PHP Code:
           while($rows mysql_fetch_array($ergebnis))
                  {
                      
          $title=$rows["title"];
                      
          $news=$rows["news"];
            echo 
          "<form name=\"edit_process.php\" method=\"post\" action=\"edit_save.php?id=$id\">
            <p>Title :
              <input type=\"text\" name=\"title\" value=\"
          $title\">
            </p>
            <p>News :</p>
            <p>
              <textarea name=\"news\" cols=\"40\" rows=\"6\">
          $news</textarea>
            </p>
            <p>
              <input type=\"submit\" name=\"Submit\" value=\"Save\">
            </p>
          </form>"

          Mfg,
          Zomi.

          Comment


          • #6
            da hast du was falsch verstanden. du solltest meinen code oben nehmen und bei dir einfügen. und davon wollte ich die ausgabe haben.
            INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


            Comment


            • #7
              PHP Code:
              $id=$_GET[id];
              //$abfrage = "SELECT title,new FROM $db_table WHERE id=$id";
              $abfrage "SELECT title,news FROM news WHERE id=$id";
              echo 
              '<pre>';
              echo 
              $abfrage;
              echo 
              '</pre>'
              Ausgabe:

              SELECT title,news FROM news WHERE id=
              You have an error in your SQL syntax near '' at line 1

              Comment


              • #8
                wie du siehtst, gibt es keine id. also musst du da nachbessern.
                INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                Comment


                • #9
                  Das ist Mein table
                  PHP Code:
                  CREATE TABLE news 
                  id INT (11not null AUTO_INCREMENT
                  title VARCHAR (50), 
                  news TEXT 
                  author VARCHAR (50) , 
                  date DATE 
                  PRIMARY KEY (id
                  ); 
                  Außerdem wenn ich bein PHPmyadmin mit dem Befehl
                  PHP Code:
                  SELECT FROM `newsWHERE id=
                  Bekomme ich auch die Antwort.

                  Comment


                  • #10
                    Original geschrieben von zomi
                    Außerdem wenn ich bein PHPmyadmin mit dem Befehl [...] Bekomme ich auch die Antwort.
                    na logo. weil die 1 hinten dran ist. aber in deinem script ist dort keine 1.

                    schaue dir doch mal deine ausgabe genau an, die du eben gepostet hast.

                    wenn du mal statt ...
                    PHP Code:
                    $abfrage "SELECT title,news FROM news WHERE id=$id"
                    ... dies hier machst, also die 1 fest einträgst ....
                    PHP Code:
                    $abfrage "SELECT title,news FROM news WHERE id=1"
                    ... dann hast du auch ne ausgabe.

                    also nochmal. deine variable $id hat keinen inhalt oder zumindest einen ungültigen.
                    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                    Comment


                    • #11
                      doch habe Inhalt oder
                      PHP Code:
                      #
                      # Dumping data for table `news`
                      #

                      INSERT INTO news VALUES (1'test''This is my news test scripts''thomas''2003-09-26'); 

                      Comment


                      • #12
                        in der tabelle schon. aber nicht hier!

                        PHP Code:
                        $id=$_GET[id]; 
                        INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                        Comment


                        • #13
                          d.h sollte ich nicht so benutzen?

                          Oh Gott,langsam hasse ich schon PHP&mysql.

                          Hilfen Sie mir doch weiter...

                          Comment


                          • #14
                            verwenden kannst du das schon. nur musst du auch daten in $id reinbekommen. so wie das aussieht übergibst du aber keine id an dein script.
                            INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


                            Comment


                            • #15
                              kann ich nicht mir weiter denken...

                              was mache jetzt nun....

                              Comment

                              Working...
                              X