CodeIgniter Forums

Full Version: accessing a $_SESSION variable is failing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
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.
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]om'")

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
Solved. I needed to use '$campaign' in the query string.

Thx
If you using double quotes you can do it like this.

PHP Code:
{$campaign
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){}
Try this and let me know if it works.

PHP Code:
$cmd "soffice --convert-to png {$inputFile} --outdir {$ouputDirectory}"
(07-16-2020, 07:54 AM)InsiteFX Wrote: [ -> ]Try this and let me know if it works.

PHP Code:
$cmd "soffice --convert-to png {$inputFile} --outdir {$ouputDirectory}"
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']. 
Can you do a var_dump of it?

PHP Code:
var_dump($field_info['upload_path']);
exit(); 
(07-16-2020, 11:17 AM)InsiteFX Wrote: [ -> ]Can you do a var_dump of it?

PHP Code:
var_dump($field_info['upload_path']);
exit(); 
I get the same error: cannot use object of type stdClass as array
Pages: 1 2