I've built a CMS in PHP and so far only ran it on my local server which is using XAMPP 3.2.2 at the moment. Everything worked fine until I uploaded it on my webserver (at Arvixe).
Here I get the error on the index page.
Parse error: syntax error, unexpected '[', expecting ')' in /home/tipsloqc/public_html/index.php on line 18
I've changed the PHP version of my Arvixe server in the public_html folder to the same version I have on my XAMPP server (5.4), but it was no use.
Any ideas why else the script may be failing?
<?php
require 'php/start.php';
$prevs = $DBH->query('SELECT * FROM prevs ORDER BY id DESC LIMIT 3')->fetchAll(PDO::FETCH_OBJ);
if (empty($_GET['cat'])) {
$pages = $DBH->query('SELECT * FROM posts ORDER BY id DESC')->fetchAll(PDO::FETCH_OBJ);
}else{
$cat = $_GET['cat'];
$pages = $DBH->prepare("
SELECT * FROM posts
WHERE category = :cat
ORDER BY id DESC
");
$pages->execute(['cat' => $cat]);
$pages = $pages->fetchAll(PDO::FETCH_OBJ);
}
$box = $DBH->query('SELECT * FROM box ORDER BY id DESC LIMIT 10')->fetchAll(PDO::FETCH_OBJ);
require VIEW_ROOT . '/home.php';