PM systeem, en ja,, een error
Ik zit (weer) met een rprobleem.
ik heb deze code:
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
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
<?php
session_start();
include ('database.php');
$login = $_SESSION['suc'];
$naam = $_SESSION['naam'];
if ($login != '1') {
echo "U bent niet ingelogd,, probeer nog een keer!";
exit ();
} else {
if(isset($_GET['page']))
{
$tid = $_GET['page'];
}
if($_SERVER['REQUEST_METHOD'] != "POST"){
echo "<FORM METHOD=\"post\" ACTION=" . $_SERVER['PHP_SELF'] . ">";
echo "<tr><td><table border=0 cellspacing=0 cellpadding=0>";
echo "<tr><td width=\"60\" valign=\"top\">To: </td><td><input name=\"mbr\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Subject: </td><td><input name=\"sub\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Message: </td><td><textarea name=\"bericht\" rows=\"6\" cols=\"50\"></textarea>";
echo "<tr><td width=\"60\"> </td><td><input type=\"submit\" name=\"submit\" value=\"Post it!\">";
echo "</table></td></tr>";
echo "</FORM>";
} else {
$sql = "SELECT id,naam FROM game_members WHERE naam = '".$_POST['mbr']."'";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
$mid = nl2br(htmlspecialchars($row['id']));
$sql2 = "SELECT id,naam FROM game_members WHERE naam = '".$_SESSION['naam']."'";
$res2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array($res2)) {
$aid = $row2['id'];
$sub = nl2br(htmlspecialchars($_POST['sub']));
$bericht = nl2br(htmlspecialchars($_POST['bericht']));
mysql_query("INSERT INTO forum_reacties (sub,bericht,mid,aid) values ('".$sub."','".$bericht."','".$mid."','".$aid."')");
}
}
}
}
?>
session_start();
include ('database.php');
$login = $_SESSION['suc'];
$naam = $_SESSION['naam'];
if ($login != '1') {
echo "U bent niet ingelogd,, probeer nog een keer!";
exit ();
} else {
if(isset($_GET['page']))
{
$tid = $_GET['page'];
}
if($_SERVER['REQUEST_METHOD'] != "POST"){
echo "<FORM METHOD=\"post\" ACTION=" . $_SERVER['PHP_SELF'] . ">";
echo "<tr><td><table border=0 cellspacing=0 cellpadding=0>";
echo "<tr><td width=\"60\" valign=\"top\">To: </td><td><input name=\"mbr\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Subject: </td><td><input name=\"sub\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Message: </td><td><textarea name=\"bericht\" rows=\"6\" cols=\"50\"></textarea>";
echo "<tr><td width=\"60\"> </td><td><input type=\"submit\" name=\"submit\" value=\"Post it!\">";
echo "</table></td></tr>";
echo "</FORM>";
} else {
$sql = "SELECT id,naam FROM game_members WHERE naam = '".$_POST['mbr']."'";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
$mid = nl2br(htmlspecialchars($row['id']));
$sql2 = "SELECT id,naam FROM game_members WHERE naam = '".$_SESSION['naam']."'";
$res2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array($res2)) {
$aid = $row2['id'];
$sub = nl2br(htmlspecialchars($_POST['sub']));
$bericht = nl2br(htmlspecialchars($_POST['bericht']));
mysql_query("INSERT INTO forum_reacties (sub,bericht,mid,aid) values ('".$sub."','".$bericht."','".$mid."','".$aid."')");
}
}
}
}
?>
Maar ik krijg niks in mijn database. Er word dus niks toegevoegd!! hoe kan dit?
ook met aan?
nee met error reporting ook GEEN error :-(
Zit er al wel iets in de database, aangezien je je gegevens binnen een while-loop in de database zet. Als dat niet het geval is wordt de while-loop namelijk niet uitgevoerd.
er zit al wel iets in me db ja ;-)
mysql_query("INSERT INTO forum_reacties (sub,bericht,mid,aid) values ('".$sub."','".$bericht."','".$mid."','".$aid."')");
voor dit:
mysql_query("INSERT INTO forum_reacties (sub,bericht,mid,aid) values ('".$sub."','".$bericht."','".$mid."','".$aid."')") or die (mysql_error());
Gewijzigd op 01/01/1970 01:00:00 door Niek Berckmans
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
echo "<FORM METHOD=\"post\" ACTION=" . $_SERVER['PHP_SELF'] . ">";
echo "<tr><td><table border=0 cellspacing=0 cellpadding=0>";
echo "<tr><td width=\"60\" valign=\"top\">To: </td><td><input name=\"mbr\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Subject: </td><td><input name=\"sub\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Message: </td><td><textarea name=\"bericht\" rows=\"6\" cols=\"50\"></textarea>";
echo "<tr><td width=\"60\"> </td><td><input type=\"submit\" name=\"submit\" value=\"Post it!\">";
echo "</table></td></tr>";
echo "</FORM>";
?>
echo "<FORM METHOD=\"post\" ACTION=" . $_SERVER['PHP_SELF'] . ">";
echo "<tr><td><table border=0 cellspacing=0 cellpadding=0>";
echo "<tr><td width=\"60\" valign=\"top\">To: </td><td><input name=\"mbr\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Subject: </td><td><input name=\"sub\"</td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Message: </td><td><textarea name=\"bericht\" rows=\"6\" cols=\"50\"></textarea>";
echo "<tr><td width=\"60\"> </td><td><input type=\"submit\" name=\"submit\" value=\"Post it!\">";
echo "</table></td></tr>";
echo "</FORM>";
?>
voor dit:
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
echo "<FORM METHOD=\"post\" ACTION=" . $_SERVER['PHP_SELF'] . ">";
echo "<table border=0 cellspacing=0 cellpadding=0>";
echo "<tr><td width=\"60\" valign=\"top\">To: </td><td><input type=\"text\" name=\"mbr\"></td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Subject: </td><td><input type=\"text\" name=\"sub\"></td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Message: </td><td><textarea name=\"bericht\" rows=\"6\" cols=\"50\"></textarea>";
echo "<tr><td width=\"60\"> </td><td><input type=\"submit\" name=\"submit\" value=\"Post it!\">";
echo "</td></tr></table>";
echo "</FORM>";
?>
echo "<FORM METHOD=\"post\" ACTION=" . $_SERVER['PHP_SELF'] . ">";
echo "<table border=0 cellspacing=0 cellpadding=0>";
echo "<tr><td width=\"60\" valign=\"top\">To: </td><td><input type=\"text\" name=\"mbr\"></td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Subject: </td><td><input type=\"text\" name=\"sub\"></td></tr>";
echo "<tr><td width=\"60\" valign=\"top\">Message: </td><td><textarea name=\"bericht\" rows=\"6\" cols=\"50\"></textarea>";
echo "<tr><td width=\"60\"> </td><td><input type=\"submit\" name=\"submit\" value=\"Post it!\">";
echo "</td></tr></table>";
echo "</FORM>";
?>
voor iemand zonder error als output geef je dit topic wel een vreemde naam
[/off]
is de error
Ik was met 2 scripts tegelijk bezig, de tabel 'forum_reacties' moest 'game_pbs' heten :p