accessing a $_SESSION variable is failing |
I have a little code sitting in a php file that is in the assets directory. I know that is not normal, but this is where the vendor keeps it. When that code runs the line below is executed.
$campaign=$this->$_SESSION['campaign']; However, $campaign yields null (as seen in the debugger). But when I look at it in the debugger, $_SESSION[campaign'] has the string "Apple" in it. How can I get the value of the $_SESSION into the variable $campaign?
proof that an old dog can learn new tricks
Is the session started by you or the file in the assets vendor?
If the session is already started you should be able to get like below. PHP Code: $campaign = $_SESSION[campaign']; try that. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
That worked to load $campaign. I am having a problem with the query
->query("SELECT bus_comp FROM business_components WHERE campaign=$campaign AND email='[email protected]'") I get : An uncaught Exception was encountered Type: Error Message: Call to a member function execute() on boolean Filename: /app/vendor/koolreport/core/src/datasources/MySQLDataSource.php Line Number: 384
proof that an old dog can learn new tricks
Solved. I needed to use '$campaign' in the query string.
Thx
proof that an old dog can learn new tricks
If you using double quotes you can do it like this.
PHP Code: {$campaign} What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I am trying to build a string to use in this cmd
$cmd = "soffice --convert-to png ".$inputFile." --outdir ". $ouputDirectory; I tried using $inputFile="/app".{$field_info['upload_path']}; to build the input file name. But I get this error: Error: Cannot use object of type stdClass as an array $field_info is coming from the function: function callback_after_upload2($uploader_response,$field_info, $files_to_upload){}
proof that an old dog can learn new tricks
Try this and let me know if it works.
PHP Code: $cmd = "soffice --convert-to png {$inputFile} --outdir {$ouputDirectory}"; What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-16-2020, 07:54 AM)InsiteFX Wrote: Try this and let me know if it works.The problem is getting the $inputFile. $inputFile="/app".$field_info['upload_path']; This is in a call back where $field_info is a structure being passed to the callback. upload_path contains the full path to the file that was just uploaded. I need to add /app onto the front of it. But I can't seems to access $field_info['upload_path'].
proof that an old dog can learn new tricks
Can you do a var_dump of it?
PHP Code: var_dump($field_info['upload_path']); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |