Jump to content

[SOLVED] Problem with implode function - Ivalid arguments passed.


MadnessRed

Recommended Posts

I am having a problem with the implode function. I am running the following code.

 

if(strlen($target['messages']) == 0){ $target['messages'] = '0,0,0,0,0,0'; }
$messages = explode(",",$target['messages']);
$messages[$type] += 1;
$target['messages'] = implode(",",$mesages);

 

$target['messages'] is either an imploded array eg 1,2,4,3,5,2 or its null. $target is a row form the database.

 

however I am getting the following error.

implode() [function.implode]: Invalid arguments passed

if I print_r($messages) this is what i get.

 

Array ( [0] => 0 [1] => 0 [2] => 1 [3] => 0 [4] => 0 [5] => 0 )

 

Any help would be great. Thanks

you have a typo.

implode(",",$mesages);

should be

implode(",",$messages);

 

Regards ACE

 

:) thanks

 

actually I am still getting the same error.

 

//Set messages of this type to +1
if(strlen($target['messages']) == 0){ $target['messages'] = '0,0,0,0,0,0'; }
$messages = explode(",",$target['messages']);
$messages[$type] += 1;
print_r($messages);
$newmessages = implode(",",$messages);

 

Outputs

Array ( [0] => 0 [1] => 0 [2] => 1 [3] => 0 [4] => 0 [5] => 0 ) 

Gives error

implode() [function.implode]: Invalid arguments passed

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.