Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi Leutz,

ih hab nen Problem...also ich möchte mit dem Insert Befehl was

in eine Datenbank über ein Formular einfügen...das funktioniert nicht. Es kommt aber keine Fehlermeldung - er fügt einfach nix ein...! Kann da einer helfen?

Hier ist der Code vom Formular:

<!-- news_einfuegen.php / Adminbereich -->

<html>
<head>
<title>Admin-Bereich</title>
<link rel="stylesheet" type="text/css" href="http://www.sebastian-muth.de/admin/admin_style.css">
</head>
<body leftMargin="1" topMargin="1">
<b><h1>News einfügen</h1></b>
<br>
Sie können hier Ihrer Website wichtige News einfügen.
<br>
Zu wichtigen News zählt u. a. Stellungnahmen zu Serverausfällen, zu Updates, Viren, etc.!
<br>
<form name="news_einfuegen" method="POST" action="http://www.sebastian-muth.de/admin/html/news_einfuegen_db.php">
<table border="0" cellpadding="1" cellspacing="1">
<tr>
<td><b>Titel:</b></td>
<td><input type="text" name="titel" class="rahmen" size="41"></td>
</tr>
<tr>
<td><b>Text:<br><br><br><br><br><br><br><br></b></td>
<td><textarea name="text" cols="40" rows="9" class="rahmen"></textarea></td>
</tr>
<tr>
<td><b>Autor:</b></td>
<td><input type="text" name="autor" class="rahmen" size="41"></td>
</tr>
<tr>
<td><b>Datum:</b></td>
<td><input type="text" name="datum" class="rahmen" size="41"></td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td><div align="right"><input type="submit" name="abschicken" value="Abschicken"></div></td>
</tr>
</table>
</form>
</body>
</html>[/PHP]

Und hier der Code der Insert-Funktion:

[PHP]<!-- news_einfuegen_db.php / Adminbereich -->

<?php

$host = "xyz";
$name = "xyz";
$passwort = "xyz";

$sql = mysql_connect($host, $name, $passwort);
$dbname = "xyz";
mysql_select_db($dbname);

$insert = "INSERT INTO `mitteilungen` (titel, text, autor, datum) values ($_POST[titel], $_POST[text], $_POST[autor], $_POST[datum])";
mysql_query($insert);

mysql_close($sql);
?>

Danke im Vorraus...

Sebastian

er gibt das aus:

INSERT INTO `mitteilungen` (titel, text, autor, datum) values (Test-News, Dies sind nur TEST-News!, Sebastian Muth, 07.02.2004)

ok, danke...ich werds mal ausprobieren...

sorry, funzt leider auch nicht...irgendwie mach ich da was falsch...;)!

las dir mal die mysql fehler anzeigen.

mysql_query($insert) or die(mysql_error());

Das ist die Fehlermeldung:

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 'Nr. 2, Dies sind wieder nur TEST-News!, Sebastian Muth, 08.02.2

so:

<!-- news_einfuegen_db.php / Adminbereich -->

<?php

$host = "xyz";
$name = "xyz";
$passwort = "xyz";

$sql = mysql_connect($host, $name, $passwort);
$dbname = "xyz";
mysql_select_db($dbname);

$insert = "INSERT INTO `mitteilungen` (`titel`, `text`, `autor`, `datum`) VALUES ($_POST[titel], $_POST[text], $_POST[autor], $_POST[datum])";
mysql_query($insert) or die(mysql_error());

print $insert;

mysql_close($sql);
?>[/PHP]

Sebastian

ok, danke! es geht! dann war es mal wieder nen fehler von mir...;)!

sebastian

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.