Can someone tell me why the most simple code (below) throws
Parse error: syntax error, unexpected '{' on line 2
WTF?
I checked some very similar code on another website on the same hosting package and it is now throwing the error aswell! Only thing i can think of is Vidahost recently upgraded to php 5, but the try statement still exists in php 5. This is infuriating me, it's so stupid!
Parse error: syntax error, unexpected '{' on line 2
WTF?
I checked some very similar code on another website on the same hosting package and it is now throwing the error aswell! Only thing i can think of is Vidahost recently upgraded to php 5, but the try statement still exists in php 5. This is infuriating me, it's so stupid!
PHP:
<?php
try{
$conn=$dbh=mysql_connect ("localhost", "", "");// or die ('Cannot connect to the database because: ' . mysql_error());
mysql_select_db("kimmystr_wordpress");// or die('Could not select database ');
$pauthor=$_POST["author"];
$pcontent=$_POST["comment"];
$result = mysql_query("insert into wp_comments(comment_author, comment_date, comment_content) values('$pauthor', now(), '$pcontent')");// or die('Fail');
header('Location: http://www.kimmystravels.co.uk/wp-content/themes/main/messages.php?result=success');
}
catch (Exception $e) {
header('Location: http://www.kimmystravels.co.uk/wp-content/themes/main/messages.php?result=fail');
}
?>