php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2005-2

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 25.10.2005, 19:51  
Gast
 
Beiträge: n/a
Standard 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
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 25.10.2005, 20:02  
Clan
Gast
 
Beiträge: n/a
Standard

was gibt denn http://de2.php.net/mysql_error aus?
 
Alt 25.10.2005, 20:07  
Gast
 
Beiträge: n/a
Standard

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">
...
 
Alt 25.10.2005, 20:09  
Clan
Gast
 
Beiträge: n/a
Standard

Benutzt du http://de3.php.net/mysql_escape_string ?

Wenn nicht , dann dürfte dies jetzt funktionieren.
Falls nicht , Poste mal die MYSQL Query.
 
Alt 25.10.2005, 20:14  
Gast
 
Beiträge: n/a
Standard

Geht wieder nicht: You have an error in your SQL syntax near '\na.colorlink3 {text-decoration: none; font-weight:' at line 1
 
Alt 25.10.2005, 20:20  
Clan
Gast
 
Beiträge: n/a
Standard

poste mal deinen code
 
Alt 25.10.2005, 20:24  
Gast
 
Beiträge: n/a
Standard

Ähm, mache ich ungern (ist außerdem extrem lang). Ich versuche mal ein Beispiel zu programmieren, wo der gleiche Fehler auftritt.
 
Alt 25.10.2005, 20:28  
Clan
Gast
 
Beiträge: n/a
Standard

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();
.
.
.
?>
 
Alt 25.10.2005, 20:34  
Gast
 
Beiträge: n/a
Standard

Es geht. Vielen, vielen Dank!
 
Alt 25.10.2005, 21:42  
Gast
 
Beiträge: n/a
Standard

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...
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
JavaScript/PHP: qooxdoo 0.7.1 - Teil 1 : Eine Einführung Zergling-new Tutorials 6 25.01.2008 10:41
CSS - Bild im div container überlappt andere container Buschdieb HTML, Usability und Barrierefreiheit 13 19.07.2007 23:17
Bilder in Text platzieren, der aus einer Datenbank kommt Erecthoma2006 PHP Tipps 2006 7 18.09.2006 09:39
Text teilen und in $var aufnehmen CHRIS PHP Tipps 2006 15 16.09.2006 19:45
CSS - Design (clear - Problem) HTML, Usability und Barrierefreiheit 7 21.12.2005 14:55
Text aus der DB verteilen PHP Tipps 2007 17 16.11.2005 12:04
[Erledigt] Link PHP Tipps 2005-2 10 20.07.2005 21:28
Text aus Datenbank ... PHP Tipps 2005-2 4 18.07.2005 11:31
[Erledigt] Text zeilenweise in Datenbank reinschreiben Datenbanken 15 30.05.2005 11:36
[Erledigt] DIV´s wollen nicht wie ich das will :-) HTML, Usability und Barrierefreiheit 22 28.03.2005 18:36
Buchstaben werden nicht in Datenbank gespeichert (TEXT) Connar PHP Tipps 2005 1 23.01.2005 20:19
frames probleme HTML, Usability und Barrierefreiheit 6 18.01.2005 02:33
Übernahme von Text in die Datenbank PHP-Fortgeschrittene 3 17.11.2004 18:40
txt-Datei erstellen d-81 PHP Tipps 2004 12 11.08.2004 20:31
Text aus Datenbank mit Zeitvorgabe auf php-Seite automatisch PHP Tipps 2004 10 09.08.2004 00:36


Alle Zeitangaben in WEZ +2. Es ist jetzt 08:49 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.