Ankündigung

Einklappen
Keine Ankündigung bisher.

Datenbank will Text nicht aufnehmen

Einklappen

Neue Werbung 2019

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

  • Datenbank will Text nicht aufnehmen

    Hallo,

    ich habe eine Variable $ausgabe1, die einen 11437 Zeichen langen html-code enthält. Diesen Text aus der Variablen möchte ich in meine Datenbank laden. Das will nicht funktionieren. Tausche ich die Variable $ausgabe1 gegen eine Variable $test ein, die mehr als 11437 Zeichen (habe zum testen "OOOOOOOOOOOOOOOOO...." genommen), wird der Text in die Datenbank aufgenommen.

    Wo liegt der Fehler?

    $ausgabe1 wird korrekt auf dem Bildschirm ausgegeben ( echo $ausgabe1; ).


    Viele Grüße

  • #2
    was gibt denn http://de2.php.net/mysql_error aus?

    Kommentar


    • #3
      Das wird ausgespuckt: You have an error in your SQL syntax near ' a.colorlink3 {text-decoration: none; font-weight: norm' at line 1

      So beginnt mein html-code:
      <style type="text/css">
      a.colorlink3 {text-decoration: none; font-weight: normal; color:#9E9D9D;}
      a.colorlink3:visited {text-decoration: none; font-weight: normal; color:#9E9D9D;}
      a.colorlink3:active {text-decoration: none; font-weight: normal; color:#9E9D9D;}
      a.colorlink3:hover {text-decoration: none; font-weight: normal; color:#9E9D9D;}

      a.colorlink7 {text-decoration: none; font-weight: normal; color:#DF1E26;}
      a.colorlink7:visited {text-decoration: none; font-weight: normal; color:#DF1E26;}
      a.colorlink7:active {text-decoration: none; font-weight: normal; color:#DF1E26;}
      a.colorlink7:hover {text-decoration: none; font-weight: normal; color:#DF1E26;}
      .text_color_3{font-size:11px; color:#8F8E8E;}
      .style_2{background-color:#F2F2F2;}
      .style_11{background-color:#E4E4E4;}
      .subhead_8 {FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #5B5B5B;}
      </style>
      <table cellSpacing="0" cellPadding="0" width="480" border="0" bgColor="#7D7D7D">
      ...

      Kommentar


      • #4
        Benutzt du http://de3.php.net/mysql_escape_string ?

        Wenn nicht , dann dürfte dies jetzt funktionieren.
        Falls nicht , Poste mal die MYSQL Query.

        Kommentar


        • #5
          Geht wieder nicht: You have an error in your SQL syntax near '\na.colorlink3 {text-decoration: none; font-weight:' at line 1

          Kommentar


          • #6
            poste mal deinen code

            Kommentar


            • #7
              Ähm, mache ich ungern (ist außerdem extrem lang). Ich versuche mal ein Beispiel zu programmieren, wo der gleiche Fehler auftritt.

              Kommentar


              • #8
                klappt dieses beispiel bei dir?
                PHP-Code:
                <?
                .
                .
                .
                $html = '<style type="text/css"> 
                a.colorlink3 {text-decoration: none; font-weight: normal; color:#9E9D9D;} 
                a.colorlink3:visited {text-decoration: none; font-weight: normal; color:#9E9D9D;} 
                a.colorlink3:active {text-decoration: none; font-weight: normal; color:#9E9D9D;} 
                a.colorlink3:hover {text-decoration: none; font-weight: normal; color:#9E9D9D;} 

                a.colorlink7 {text-decoration: none; font-weight: normal; color:#DF1E26;} 
                a.colorlink7:visited {text-decoration: none; font-weight: normal; color:#DF1E26;} 
                a.colorlink7:active {text-decoration: none; font-weight: normal; color:#DF1E26;} 
                a.colorlink7:hover {text-decoration: none; font-weight: normal; color:#DF1E26;} 
                .text_color_3{font-size:11px; color:#8F8E8E;} 
                .style_2{background-color:#F2F2F2;} 
                .style_11{background-color:#E4E4E4;} 
                .subhead_8 {FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #5B5B5B;} 
                </style> ';

                $sql = "insert into deinetab (htmlcode) values('".mysql_escape_string($html)."')";
                mysql_query( $sql );
                echo mysql_error();
                .
                .
                .
                ?>

                Kommentar


                • #9
                  Es geht. Vielen, vielen Dank!

                  Kommentar


                  • #10
                    Kleine Frage, die nicht zum Thema passt: Wie kann ich am schnellsten herausfinden, welche von 4 Zahlen die kleinste ist? In der Zwischenzeit versuche ich selber eine gute Lösung zu finden. Melde mich, wenn ich eine habe...

                    Kommentar


                    • #11
                      Looky looky

                      Kommentar


                      • #12
                        Mit min($a,$b,$c) lässt es sich herausfinden .

                        Kommentar


                        • #13
                          Geschwindigkeit ist ziemlich wurst bei so wenigen Zahlen.

                          PHP-Code:
                          $zahlen = array(145141, -56);
                          sort($zahlen); 

                          Kommentar

                          Lädt...
                          X