Jump to content

[SOLVED] Really Confused


adamjones

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/153937-solved-really-confused/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.