Parse error: syntax error, unexpected '>'

I can’t figure this out.

//check for required fields from the form
if ((!$_POST["topic_owner"]) || (!$POST["topic_title"]) ||
(!$POST["post_text"])) {
	header("Location: addtopic.html");

//connect to server
$mysqli = mysqli_connect("localhost", "user", "", "guilmeti_final");

//create and issue the first query
$add_topic = "INSERT INTO forum_topics (topic_title, topic_create_time, topic_owner)
VALUES ('".$_POST['topic_title']."',now(), '".$_POST['topic_owner']."')";

$add_topic_res = mysqli_query($mysqli, $add_topic_sql) or die(mysqli_error($mysqli));

//get the id of the last query
$topic_id = mysqli_insert_id($mysqli);

//create and issue the  second query
$add_post_sql = "INSERT INTO forum_posts (topic_id, post_text, 
				post_create_time, post_owner) VALUES ('".$topic_id."',
				'".$_POST['post_text']."', now(),

$add_post_res = mysqli_query($mysqli, $add_post_sql)
				or die(mysqli_error($mysqli));


$display_block = "<p>The <strong>".$_POST['topic_title']."</strong> topic has been created.</p>"; 

<title>New Topic Added</title>
<h1>New Topic Added</h1>
<?php echo $display_block; ?>

1: Moved this to the appropriate section.
2: What errors are you getting?
3: What did you find out using Google and
4: Have you tried debugging as per my signature?

I swore I posted to this already, but I may be crazy.

For one you could try to format insert querys as follows:

$q = “INSERT INTO mytable (field1, filed2) VALUES (’$value1’, ‘$value2’)”;

This would help to alleviate any problems that may be caused.

If you used a variable instead of the $_POST[’’] you could save yourself keystrokes.

$topic_owner = $_POST[‘topic_owner’];

Then $topic_owner is all you would need any time you wanted to referance that bit of information.

Sponsor our Newsletter | Privacy Policy | Terms of Service