Attribute Select Max Characters
Permalink
I'm using a select attribute to store sentences that are then looped over to output a ul li.
My problem is that after so many characters, I get an SQL error, saying its too long.
My problem is that after so many characters, I get an SQL error, saying its too long.
sqlstate 22001 string data right truncated 1406 data too long for column
Yeah, Willem is right. The text is too long to fit in the select option value column. The max length is set to 255 chars in the database. You can of course change the column type to a TEXT for example, but I wouldn't recommend it.
Maybe you can use a textfield attribute or something where you explode (see PHP manual) on a line break or some special character?
Maybe you can use a textfield attribute or something where you explode (see PHP manual) on a line break or some special character?
Thank you for the suggestion, my solution was by following your instructions:
First grab the text field containing each item on its own line:
Then explode the text area by line break:
Then loop over each item in the newly created list array and output in an li:
First grab the text field containing each item on its own line:
$details = $c->getAttribute('text_area');
Then explode the text area by line break:
$list = explode("\n", $details);
Then loop over each item in the newly created list array and output in an li:
<ul> <? foreach ($list as $list_item):?> <li> <?=$list_item?> </li> <?endforeach?> </ul>
Post some code and info plz