tags:

views:

297

answers:

4
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/a9184872/public_html/test_forum/admin.php on line 158

I get that error when I try to run my script. I read that the error is sometimes caused by lines before the line stated so here are lines 154 - 160.

if(strlen($desc) > 255){
    echo "The description must be under 255 characters.\n";
}else {
    $row4 = mysql_fetch_assoc($res7);
    $sql9 = "INSERT INTO `sub_categories` (`c_id`,`name`,`desc`,`admin`) VALUES('".$cat."','".$name"','".$desc."','".$row4['admin']."')";
    $res9 = mysql_query($sql9) or die(mysql_error());
    echo "The forum sub category: <b>".$name."</b> has been added under the main category: <b>".$row4['name']."</b>\n";

I can give more lines if anybody needs them.

Thank you in advance.

+1  A: 
'".$name"'

You're missing a '.' after name.

Sean Bright
A: 

You are missing a dot operator.

$sql9 = "INSERT INTO `sub_categories` (`c_id`,`name`,`desc`,`admin`) VALUES('".$cat."','".$name."','".$desc."','".$row4['admin']."')";
                                                                                              ^^^
strager
A: 

Thank you :)

A: 

For future reference, when you see that error it usually indicates a missing dot, brace, quote, etc. Using an IDE like Netbeans or Eclipse PDT will highlight those sorts of errors and make them easy to spot quickly.

gaoshan88