Need help passing array of number into in custom block
Permalink
Hi, guy
in my edit.php i manage to pass array of integer into my controller problem its how im suppose to save it then pass it to the view i know i have the array because i pass the count($array) into view and show exact number of item i have. Any help will be appreciated.
in my edit.php i manage to pass array of integer into my controller problem its how im suppose to save it then pass it to the view i know i have the array because i pass the count($array) into view and show exact number of item i have. Any help will be appreciated.
The link doesn't work for me I serialize and unserialize work with a array of string but when trying with array of number it's showing a error 1064
It may be something within the serialized string that throws mysql, perhaps nested quotes or use of single quotes.
Some ideas to try (not all at the same time):
- map each array element to a string first
- run addslashes() on the serialized string
- use JSON instead of php serialize
Some ideas to try (not all at the same time):
- map each array element to a string first
- run addslashes() on the serialized string
- use JSON instead of php serialize
The howto on saving and serializing arrays is now published:
http://www.concrete5.org/documentation/how-tos/developers/save-and-...
http://www.concrete5.org/documentation/how-tos/developers/save-and-...
You can do this with php serialize/unserialize, or via json, or just implode/explode for simple data.
I have just put together some more detailed notes as a howto. The link below will work in a day or two when the howto is approved:
http://www.concrete5.org/?cID=569848...