Welcome Guest, Not a member yet? Register   Sign In
Converting from Standard PHP to CodeIgniter
#1

[eluser]KaBaDaBrA[/eluser]
Hey guys,

I'm having an issue converting the following to be usable in CodeIgniter...can anyone point me in the right direction? TIA Confusedmirk:

Code:
$_SESSION['chatHistory'][$_POST['to']] .= <<<EOD
{
    "s": "1",
    "f": "{$to}",
    "m": "{$messagesan}"
},
EOD;
#2

[eluser]Phil Sturgeon[/eluser]
Where is your session_start()?
#3

[eluser]KaBaDaBrA[/eluser]
its just a snippet of the code im having a problem with...obviously ill be using the codeigniter library session but cant figure out what to do...here is an example of what I tried to do in CodeIgniter...

Code:
$to = $this->input->post('to');
$this->session->userdata('chatHistory', $to) .= <<<EOD
{
    "s": "1",
    "f": "{".$to}."",
    "m": "{".$messagesan."}"
},
EOD;
#4

[eluser]Phil Sturgeon[/eluser]
You don't assign values to class methods.

Code:
$to = $this->input->post('to');
$this->session->set_userdata('chatHistory', <<<EOD
{
    "s": "1",
    "f": "{".$to}."",
    "m": "{".$messagesan."}"
},
EOD);
#5

[eluser]KaBaDaBrA[/eluser]
ahhh, but is there another way to add those variables instead of using the "<<<EOD" thing...no idea what that does :\ CodeIgniter doesn't like the '<<<EOD' inside of the the '$this->session->set_userdata('chatHistory...', <<<EOD'
#6

[eluser]Phil Sturgeon[/eluser]
PHP Manual: Strings
#7

[eluser]KaBaDaBrA[/eluser]
erm ok found the problem, seems you can have spaces when using <<<EOD etc...its finnicky...my apologies about my confused explanation too...been a crazy day, thanks for you help Phil!
#8

[eluser]Unknown[/eluser]
hello KaBaDaBrA ,

Can u send me the code for setting the session with eod,iam also having same problem.

waiting for ur reply.

Thanks,
kranthi




Theme © iAndrew 2016 - Forum software by © MyBB