<?php
$host="localhost"; // Host name
$username="kennegy51"; // Mysql username
$password="b47e6n6t"; // Mysql password
$db_name="kennegy51_wwe"; // Database name
$tbl_name="forum_answer"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get value of id that sent from hidden field
$id=$_POST['id'];
// Find highest answer number.
$sql="SELECT MAX(a_id) AS Maxa_id FROM $tbl_name WHERE question_id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
// add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1
if ($rows) {
$Max_id = $rows['Maxa_id']+1;
}
else {
$Max_id = 1;
}
// get values that sent from form
$a_name=$_SESSION['usr'];
$a_email=$_SESSION['email'];
$a_answer=$_POST['a_answer'];
$datetime=date("d/m/y H:i:s"); // create date and time
echo "Successful<BR>";
echo "<a href='view_topic.php?id=".$id."'>View your answer</a>";
// If added new answer, add value +1 in reply column
$tbl_name2="forum_question";
$sql3="UPDATE $tbl_name2 SET reply='$Max_id' WHERE id='$id'";
$result3=mysql_query($sql3);
}
else {
echo 'ERROR';
}
mysql_close();
?>
DevilsHorse
2011-12-05 21:39:45
Hey, dit is de forum die'k ergens gevonden heb. Maar blijkbaar als ik bv aaa''""é post dan echo'd ie ERROR.
Enig idee hoe'k dit kan oplossen? Ben al dagen radeloos aan het zoeken en wil maar niet werken.
DevilsHorse
2011-12-05 21:50:24
*een deel van m'n forum.
Ander deel doet een form action naar deze page.