Gegen Bilderklau - Das Original (https://www.gegen-bilderklau.net/index.php)
- Design, Website, Copyright (https://www.gegen-bilderklau.net/board.php?boardid=80)
--- Homepagehilfe (https://www.gegen-bilderklau.net/board.php?boardid=27)
---- Homepagehilfe - Archiv (https://www.gegen-bilderklau.net/board.php?boardid=139)
----- [PHP & MySQL] MySQL/PHP INSERT-Problem (https://www.gegen-bilderklau.net/thread.php?threadid=88471)


Geschrieben von Lena-Aquila am 19.11.2006 um 10:15:

  MySQL/PHP INSERT-Problem

Ja, ich mal wieder: Ich mach grad ein Album für die Fotos vom letzten Famiienfest...Da soll es auch eine "Kommentieren"-Funktion geben, aber es will und will nicht klappen! Der Code:
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:

<?php
if (isset($_GET[id])) {
$id $_GET[id];
$sql "SELECT * FROM bmd_fotos WHERE id = '$_GET[id]'";
$res mysql_query($sql);
while ($row mysql_fetch_assoc($res)) {
echo <<<BILDER
<table cellpadding="0" cellspacing="0">
<tr>
<td>$row[title]</td><td>Von: $row[made_by]</td>
</tr>
<tr>
<td colspan="2"><img src="$row[title]"></td>
</tr>
<tr>
<td><a href="$row[name]">Download?</a></td><td></td>
</tr>
<tr>
<td> <b> Kommentieren </b></td></td></td>
</tr>
<tr>
<form action="$_SERVER[PHP_SELF]" method = "post">
<td>Mitteilung:</td><td><textarea name="comment"></textarea></td>
</tr>
<tr>
<td>Name:</td><td><input type="text" name="name"></td>
</tr>
<tr>
<td><input type="submit" value="Abschicken" name="send"></td><td><input type="reset" value="Zurücksetzen"></td>
</form>
</tr>
</table>
BILDER;
if (isset($_POST[send])) {
if (isset($_POST[comment])) {
if (isset($_POST[name])) {
$comment $_POST[comment];
$name $_POST[name];
$sql "INSERT INTO bmd_comments ('id', 'mid', 'name', 'comment')  VALUES ('', '$id', '$name', '$comment')";
$res mysql_query($sql);
if ($res) {
echo "Danke für den Kommentar. <a href=fotos.php>Zurück zur Startseite?</a>";
}
}
}
}
}
$sql2 "SELECT * FROM bmd_comments WHERE mid='$_GET[id]'";
$res mysql_query($sql2);
while ($row mysql_fetch_assoc($res)) {
echo "<b>Bereits abgegebene Kommentare:</b>";
echo "<br>$row[comment]<br><i>von $row[name]";
}
}
?>

Ist jetzt wahrscheinlich ein bisschen zu viel, aber nur so zur Vorsicht. Ich nehme an, dass der Fehler in diesem Bereich steckt:
php:
1:
2:
$sql "INSERT INTO bmd_comments ('id', 'mid', 'name', 'comment')  VALUES ('', '$id', '$name', '$comment')";
$res mysql_query($sql);

Hoffe, ihr könnt mir helfen..

LG,LMB, Aqui



Geschrieben von Lena-Aquila am 20.11.2006 um 19:07:

 

Einfach gar nichts...also doch, das Formular eben und so, aber es wird nichts in die DB eingetragen...

LG, LMB, Aqui



Geschrieben von Lars007 am 20.11.2006 um 19:15:

 

Würdest du bei PHP-Quellcode [php]-Tags benutzen, kämen wir alle in den Genuss von Syntax-Highlighting. Augenzwinkern



Geschrieben von Lena-Aquila am 24.11.2006 um 17:43:

 

Hilft bei mir leider nicht...Trotzdem Danke!

LG, LMB, Aqui


Forensoftware: Burning Board, entwickelt von WoltLab GmbH