Customizing SMF > SMF Coding Discussion

implode Array problem

<< < (2/5) > >>

emanuele:
Then something less compact:

--- Code: ---$profile['wizard'] = $profile['wizard'] . (!empty($profile['wizard']) ? ',' : '') . 'image12';
--- End code ---

The Wizard:
Sorry I still get the same problemit just wrights over all the data in the column.

Here is the latest code -

--- Code: ---function onUse()
{

global $user_info;

    $profile['wizard'] = $profile['wizard'] . (!empty($profile['wizard']) ? ',' : '') . 'image12';

updateMemberData($user_info['id'], array('wizard' => $profile['wizard']));

return '<br>You now own 12 long-stem roses.<br /><br />We here at Acme Florists division hopes that they will brighten your day.<br />
<br />Enjoy<br />
<br />Acme Division Products Company<br /><br />';
}
--- End code ---

The Wizard:
Ok form the limited test I have been able to run it looks like the code is not reading
--- Quote ---$profile['wizard']
--- End quote ---
.

emanuele:
Well, that was another bug I overlooked whan I wrote all the others... :P

Of course you have to use the variable you have available, not one that you used in another function.
So it will *probably* (no idea because I don't remember all the code) $user_info['wizard']

The Wizard:
You mean something like this. By the way the code below does not work. All it does is rewrite over the data in the column.


--- Code: ---function onUse()
{

global $profile, $user_info;


$profile['wizard'] = $profile['wizard'] . (!empty($profile['wizard']) ? ',' : '') . 'image12';

    updateMemberData($user_info['id'], array('wizard' => $profile['wizard']));

return '<br>You now own 12 long-stem roses.<br /><br />We here at Acme Florists division hopes that they will brighten your day.<br />
<br />Enjoy<br />
<br />Acme Division Products Company<br /><br />';
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version