CodeIgniter Forums
illegal string message - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Regional User Groups (https://forum.codeigniter.com/forumdisplay.php?fid=25)
+--- Thread: illegal string message (/showthread.php?tid=70624)



illegal string message - elliotash - 05-05-2018

Hello allĀ 

I am getting this message

A PHP Error was encountered
Severity: Warning
Message: Illegal string offset '$_GET['companyName']'
Filename: libraries/Profiler.php
Line Number: 276


this is the line code

$output['$_GET['. $key .']'] = htmlspecialchars(stripslashes($val));

Can anybody help?

Cannot seem to figure out what is wrong


RE: illegal string message - InsiteFX - 05-05-2018

There is something wrong with companyName or it is not in the GET array.


RE: illegal string message - jreklund - 05-05-2018

You got too many ' in your code.
Code:
$output[$_GET[$key]] = htmlspecialchars(stripslashes($val));



RE: illegal string message - qury - 05-09-2018

also out of curiosity, what is the value of $_GET['companyName'] ?


RE: illegal string message - elliotash - 05-09-2018

(05-05-2018, 06:38 AM)jreklund Wrote: You got too many ' in your code.
Code:
$output[$_GET[$key]] = htmlspecialchars(stripslashes($val));
the code is executing a search for the 'name' value


RE: illegal string message - elliotash - 05-09-2018

(05-09-2018, 11:13 PM)elliotash Wrote:
(05-05-2018, 06:38 AM)jreklund Wrote: You got too many ' in your code.
Code:
$output[$_GET[$key]] = htmlspecialchars(stripslashes($val));
the code is executing a search for the 'name' value

could you also clarify your statementĀ  too many ' in my code


RE: illegal string message - Vitaly83 - 05-09-2018

Append to previous answers:
1. Did you edit CI system files? I highly recommend you to create MY_... files (in the application folder) instead.
2. It's good practice to use $this->input->get() instead of $_GET.
3. In your code used '$_GET['companyName']' as an $output index, not the value of $_GET['companyName'].