sayousaad sayousaad - 4 months ago 17
Javascript Question

Page doesn't work in server

I create a Statistics page with javascript/php when I try it in my localhost it's work without any problem

but when I make it in an on ligne server

Microsoft Edge give me this result : HTTP 500 error

That's odd... Microsoft Edge can’t find this page

And Firefox give me a white page

why ?!!

You can show the result here :


http://hipponeimmo.com/test/charts.php


the error_log said :


[10-Jul-2016 17:03:28 Europe/Berlin] PHP Parse error: syntax error, unexpected '[' in /home/hipponeimmo/public_html/test/charts.php on line 95


In this line I have this:

$sql = "SELECT * FROM statistics WHERE MONTH(st_date) = '$date1' and YEAR(st_date) = '$date2' ";
$sql_sel = mysqli_query($conn,$sql);
$data = [];


what I need to do ? Any help ?

Answer

You are using the new short array syntax [] which is available since PHP 5.4. You're most likely using PHP 5.3 or less on your Server, so you need to use the old syntax. Use:

$data = array();

instead of

$data = [];

and

$colors = array( 1 => '8BC34A', 2 => 'FC8213', 3 => '337AB7', 4 => '00CED1', 5 => 'ff5733', 6 => 'd733ff', 7 => 'EEEE00', 8 => '8B4500', 9 => 'FF4500', 10 => 'F08080', 11 => 'B22222', 12 => '8E8E38' );

instead of

 $colors = [ 1 => '8BC34A', 2 => 'FC8213', 3 => '337AB7', 4 => '00CED1', 5 => 'ff5733', 6 => 'd733ff', 7 => 'EEEE00', 8 => '8B4500', 9 => 'FF4500', 10 => 'F08080', 11 => 'B22222', 12 => '8E8E38' ];
Comments