syntax error - unexpected t_variable php -
i have written simple php file on openshift. started simple operation (sql) , got following error:
[sun apr 06 11:59:35 2014] [error] [client 127.2.31.1] php parse error: syntax error, unexpected t_variable in /var/lib/openshift/53413f4a500446a9c8000172/app-root/runtime/repo/test.php on line 15
here code:
<html> <head> </head> <body> <?php echo 'start'; try{ $dbh=new pdo("mysql:host=$_env{'openshift_mysql_db_host'};dbname=$_env{'openshift_app_name'}",$_env{'openshift_mysql_db_username'},$_env{'openshift_mysql_db_password'}) or die('cannot connect db');//open mysql database connection $dbh->setattribute(pdo::attr_errmode,pdo::errmode_exception); $sth=$dbh->prepare('select * from fs where filename<>? and desc<>?'); $sth->execute(array('','')); $result=$sth->fetchall(pdo::fetch_assoc); print_r($result); }catch(proexception $err){ echo $err->getmessage(); } echo 'end'; ?> </body> </html>
i used php checker , reported same error in line15. can't figure out problem. help.
i believe error lies here:
}catch(proexception $err){
unless proexception defined previously, suggested vp_arth, meant pdoexception.
}catch(pdoexception $err){
Comments
Post a Comment