Jump to content

HELP! Syxtax ERROR!


jwk811

Recommended Posts

Here's the function. The problem is when there is symbols in the reply or subject and previous message, it shows a syntax error. Probably because of quotes.

 

I used nl2br() because I thought that made it so you could use symbols.

 

I dunno what else the problem could be or how to fix this. Thanks for any help!

 

function replyTo()
{
$replyingto = $_POST['replyingto'];
$reply = $_POST['reply'];
	$reply = nl2br($reply);


$sql = "SELECT *
        FROM tbl_message
		WHERE msg_id = '$replyingto'";
$result = dbQuery($sql);

if (dbNumRows($result) == 1) {
	$row = dbFetchAssoc($result);
		extract($row);


		if($msg_status == 'read'){

		$sql   = "UPDATE tbl_message 
          			SET msg_status = 'replied'
		 		 WHERE msg_id = $msg_id";

		dbQuery($sql);
		}		

		$sub  = 'Re: ' . nl2br($msg_sub);
		$text =  $reply . '<br><br><br>-----------------------------------------<br>' . $msg_from_user .  ' wrote on ' . $msg_datetime . '<br>' . nl2br($msg_text);

		$sql = "SELECT user_name
      			  FROM tbl_user
				WHERE user_id = '$msg_to'";
		$result = dbQuery($sql);
				$row = dbFetchAssoc($result);
				$username = $row['user_name'];


	$sql   = "INSERT INTO tbl_message (msg_from, msg_from_user, msg_to, msg_sub, msg_text, msg_datetime)
     	   	  VALUES ('$msg_to', '$username', '$msg_from', '$sub', '$text', NOW())";
	dbQuery($sql);


	header('Location: index.php?view=messages');	
}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.