-3

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 ?

tkausl
  • 13,686
  • 2
  • 33
  • 50
sayousaad
  • 23
  • 5
  • firefox also gives same error.see console network tab – Madhawa Priyashantha Jul 10 '16 at 14:59
  • 3
    500 does not mean it couldn't find the page. Check your error logs. – tkausl Jul 10 '16 at 14:59
  • there must be any error in your code that's why you getting `500 Error`. Also check the configurations with your server. – bhansa Jul 10 '16 at 15:01
  • @tkausl 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 = [];` – sayousaad Jul 10 '16 at 15:09

2 Answers2

0

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' ];
tkausl
  • 13,686
  • 2
  • 33
  • 50
  • when I make your solution I think it's work but I have a problem, I have some Arrays like this `$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' ];` How I can change it to your syntax ? (array();) – sayousaad Jul 10 '16 at 15:18
  • I've added it. Essentially, you just need to replace the `[` with `array(` and `]` with `)`. – tkausl Jul 10 '16 at 15:20
  • Thanks a lot It's wooooooooooooooooooooooooork (y) – sayousaad Jul 10 '16 at 15:31
-1

I had this similar kind of error few time before. There is a possibility that you have accidentally deleted the file name "webconfig". Ask your service provider if it is the case

SattyamBhatt
  • 338
  • 2
  • 13