Willkommen auf dem Portal für Mediengestalter
|
|
Autor |
Nachricht |
Novadis
Threadersteller
Dabei seit: 20.03.2006
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 20.03.2006 17:15
Titel Daten in die Datenbank einfügen klappt nicht ! *schäm* |
|
|
Hy erstmal bin neu hier und komme gleich mit nem ziemlich komischen Problem. =)
Ich bin grad an nem cms und haben in diesem zum erstenmal tinyMCE (ein Wysiwyg editor) zum ein satz gebracht und habe jetzt meine index.php in die meine unterseiten includet werden.
Das Problem besteht darin dass ich wenn ich die edit.php aufrufe und in dieser im tinymice interface die news schreibe und die daten dann an die input.php übergeben passiert das (mit error_reporting(E_ALL); ):
Code: |
Parse error: syntax error, unexpected T_IF in C:\Programme\xampp\htdocs\CP-Neumann\Website\acp\page\news\input.php on line 60
|
ohne (mit error_reporting(E_ALL); kommt nichts .
(die config.php wird in der index.php schon icluded)
die edit.php :
Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>main</title>
<style type="text/css">
<!--
body {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
margin: 0px;
background-color: #FFF4EA;
}
.topnavi {
text-align: right;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFE0C4;
border-bottom: solid 1px #000000;
}
.topnavi a {
text-align: right;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFE0C4;
border-bottom: solid 1px #000000;
}
.topnavi a:hover {
text-align: right;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFCFA4;
border-bottom: solid 1px #000000;
}
.header {
text-align: center;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFE0C4;
}
.subtitle2 {font-size: 16px; font-weight: bold; color: #666666; font-family: Georgia, "Times New Roman", Times, serif; }
</style>
<script language="javascript" type="text/javascript" src="editor/editor/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,flash,contextmenu",
theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,advimage,link,unlink,seperator,fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
</script>
</head>
<body>
<form name="form" method="post" action="index.php?section=news&action=news_input">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><div align="left">
Titel ihrer Nachricht :
<input name="titel" type="text" id="titel" style="border:1pt solid #FF9900; background-color:#FFDBBB" size="75"/>
</div></td>
</tr>
<tr>
<td>
<div align="left">
<textarea name="content" cols="70" rows="20">Hier den Inhalt ihrer Nachricht eingeben und wie gewohnt formatieren .</textarea>
<br />
<input type="submit" name="Send" value="Eintragen" style="border:1pt solid #FF9900; background-color:#FFDBBB">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
|
die input.php :
Code: |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>main</title>
<style type="text/css">
<!--
body {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
margin: 0px;
background-color: #FFF4EA;
}
.topnavi {
text-align: right;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFE0C4;
border-bottom: solid 1px #000000;
}
.topnavi a {
text-align: right;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFE0C4;
border-bottom: solid 1px #000000;
}
.topnavi a:hover {
text-align: right;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFCFA4;
border-bottom: solid 1px #000000;
}
.header {
text-align: center;
text-decoration: none;
font-family:arial;
font-size:12px;
color: #000000;
background-color:#FFE0C4;
}
.subtitle2 {font-size: 16px; font-weight: bold; color: #666666; font-family: Georgia, "Times New Roman", Times, serif; }
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="15">
<tr>
<td>
<?php
if($_GET['action'] == 'Send'){
$title = $_POST['titel'];
$text = $_POST['content'];
$ins = "INSERT INTO news(title, text, datum) VALUES('$titel','$text',NOW())";
mysql_query($ins);
echo "News erfolgreich hinzugefügt";
}
?>
</td>
</tr>
</table>
</body>
</html>
|
hoffe ihr könnt mir helfen .
Zuletzt bearbeitet von burnout am Mo 20.03.2006 17:53, insgesamt 1-mal bearbeitet
|
|
|
|
|
Doppelplusgut
Dabei seit: 06.10.2005
Ort: Zimmer 101
Alter: 55
Geschlecht:
|
Verfasst Mo 20.03.2006 17:28
Titel
|
|
|
Wenn ich mir den Code mit richtigem Syntax-Highlighting angucke, dann fällt sofort auf, dass Du die Style-Tags bzw das
<!--
nicht schließt, füge am Ende der Definitionen mal noch ein
-->
ein, zumindest das Highlighting arbeitet dann wieder korrekt
|
|
|
|
|
Anzeige
|
|
|
Novadis
Threadersteller
Dabei seit: 20.03.2006
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 20.03.2006 17:39
Titel
|
|
|
ups stimmt ja ^^
|
|
|
|
|
Doppelplusgut
Dabei seit: 06.10.2005
Ort: Zimmer 101
Alter: 55
Geschlecht:
|
Verfasst Mo 20.03.2006 17:48
Titel
|
|
|
War das denn schon der Fehler oder meckert er immer noch?
Wenn ja, was ist denn die genaue Zeile mit dem Fehler bzw. bisschen drumherum?
|
|
|
|
|
Novadis
Threadersteller
Dabei seit: 20.03.2006
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 20.03.2006 17:59
Titel
|
|
|
also der fehler ligt hier bei "mysql_query($ins);" sagt der browser mir :
Code: |
<?php
if (isset($_POST['Send'])) {
$title = $_POST['titel'];
$text = $_POST['content'];
$ins = "INSERT INTO news(title, text, datum) VALUES('$titel','$text',NOW())";
mysql_query($ins);
echo "News erfolgreich hinzugefügt";
}
?>
|
|
|
|
|
|
Zeithase
Dabei seit: 09.05.2005
Ort: Erfurt
Alter: 39
Geschlecht:
|
Verfasst Mo 20.03.2006 18:04
Titel
|
|
|
T_IF bedeutet, dass Dein If-Statement einen Fehler beinhaltet. Ich bin nicht so der PHP-Guru -- deshalb weiß ich nicht, woran's liegt.
// Ich sehs: Einmal heißt Deine Variable $title, im SQL-Insert dann $titel.
HTH,
der Zeithase.
Zuletzt bearbeitet von Zeithase am Mo 20.03.2006 18:06, insgesamt 1-mal bearbeitet
|
|
|
|
|
Doppelplusgut
Dabei seit: 06.10.2005
Ort: Zimmer 101
Alter: 55
Geschlecht:
|
Verfasst Mo 20.03.2006 18:04
Titel
|
|
|
Versuch mal
Code: | $ins = "INSERT INTO news(title, text, datum) VALUES('".$titel."','".$text."',NOW())"; |
|
|
|
|
|
Doppelplusgut
Dabei seit: 06.10.2005
Ort: Zimmer 101
Alter: 55
Geschlecht:
|
Verfasst Mo 20.03.2006 18:06
Titel
|
|
|
Und was ich jetzt erst sehe:
Mal schreibst Du
$title
dann wieder
$titel
Datt kann nich gut gehen tun,,,
|
|
|
|
|
|
|
|
Ähnliche Themen |
Daten aus SQL Datenbank auslesen
EXIF-Daten aus Datenbank in ein JPG
kontaktformular und daten in datenbank uebernehmen
RTF mit Daten aus Datenbank befüllen & als PDF generieren
Daten aus Datenbank wiedergeben - PROBLEM IE
Daten aus Datenbank untereinander ausgeben
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|