adamjones Posted April 13, 2009 Share Posted April 13, 2009 Ok. So this is to add a reply to a forum question; <?php session_start(); ....connection stuff.... $forum=$_GET['forum']; $id=$_GET['id']; $a_name=$_SESSION['Name']; $a_answer=$_POST['a_answer']; $datetime=date("d/m/y H:i:s"); $sql="SELECT MAX(a_id) AS Maxa_id FROM $tbl_name WHERE qid='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); if ($rows) { $Max_id = $rows['Maxa_id']+1; } else { $Max_id = 1; } $sql2="INSERT INTO $tbl_name(qid, a_id, a_author, a_answer, a_datetime, forum)VALUES('$id', '$Max_id', '$a_name', '$a_answer', '$datetime', '$forum')"; $result2=mysql_query($sql2); if($result2){ header("location: topic.php?forum=".$forum."&id=".$id.""); } mysql_close(); ?> Only I'm not getting redirected, and there are no errors. Any ideas? Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 13, 2009 Share Posted April 13, 2009 Change $result2=mysql_query($sql2); to $result2=mysql_query($sql2) or die(mysql_error().": $sql2"); Quote Link to comment Share on other sites More sharing options...
adamjones Posted April 13, 2009 Author Share Posted April 13, 2009 Change $result2=mysql_query($sql2); to $result2=mysql_query($sql2) or die(mysql_error().": $sql2"); Thank you. I had given a collum a wrong name. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.