JDevOnline Posted February 25, 2017 Author Share Posted February 25, 2017 (edited) Hi Barand, PHP version on my local server is 5.6 whereas on the online server it is 5.4, this might be the reason that the script has thrown the following error on then taken online: PHP Local: 5.6PHP Online: 5.4"Parse error: syntax error, unexpected '[' in /home/content/87/html/nroll-classwise.php on line 37" When I inspected the code on the line number mentioned above it is: $data = []; Please tell me how to handle this situation, thank you. Edited February 25, 2017 by JDevOnline Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543374 Share on other sites More sharing options...
Jacques1 Posted February 25, 2017 Share Posted February 25, 2017 PHP 5.4 reached end of life back in 2015. You need to keep your server up to date. The current PHP version is 7, the last supported one from the old 5.x branch is 5.6. Actually, you don't even seem to have 5.4, because this version already supported the short array syntax. Sounds more like 5.3 or older. 1 Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543375 Share on other sites More sharing options...
JDevOnline Posted February 25, 2017 Author Share Posted February 25, 2017 Since i can not upgrade the php version to higher than 5.4, please suggest change in code, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543380 Share on other sites More sharing options...
Barand Posted February 25, 2017 Share Posted February 25, 2017 $data = []; is equivalent to $data = array(); Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543382 Share on other sites More sharing options...
Jacques1 Posted February 25, 2017 Share Posted February 25, 2017 Let me be more clear: PHP 5.4 was entirely abandoned and is full of security vulnerabilities that will never be fixed. Unless you have a special LTS operating system which provides its own PHP updates, you cannot use PHP 5.4. No amount of code will fix that. What kind of hoster and system is this? Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543383 Share on other sites More sharing options...
JDevOnline Posted February 28, 2017 Author Share Posted February 28, 2017 Let me be more clear: PHP 5.4 was entirely abandoned and is full of security vulnerabilities that will never be fixed. Unless you have a special LTS operating system which provides its own PHP updates, you cannot use PHP 5.4. No amount of code will fix that. What kind of hoster and system is this? Thanks for the info, I will either upgrade if possible or change my web hosting company, to be able to use the latest version of php, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543495 Share on other sites More sharing options...
JDevOnline Posted February 28, 2017 Author Share Posted February 28, 2017 $data = []; is equivalent to $data = array(); Hi Barand, I tried used the array declaration, as you mentioned but it is rendering a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543496 Share on other sites More sharing options...
Barand Posted February 28, 2017 Share Posted February 28, 2017 Post your current code and I'll try to run it. Quote Link to comment https://forums.phpfreaks.com/topic/303140-drawing-html-table-with-mysql-data/page/2/#findComment-1543497 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.