This is inside my Column ‘reviewsDistribution’ @myDataBase
<code>{
"oneStar": 0,
"twoStar": 0,
"threeStar": 1,
"fourStar": 2,
"fiveStar": 10
}
</code>
<code>{
"oneStar": 0,
"twoStar": 0,
"threeStar": 1,
"fourStar": 2,
"fiveStar": 10
}
</code>
{
"oneStar": 0,
"twoStar": 0,
"threeStar": 1,
"fourStar": 2,
"fiveStar": 10
}
This is what is inserted really.
It’s a json type column
<code>"{"oneStar":0,"twoStar":0,"threeStar":1,"fourStar":2,"fiveStar":10}"
</code>
<code>"{"oneStar":0,"twoStar":0,"threeStar":1,"fourStar":2,"fiveStar":10}"
</code>
"{"oneStar":0,"twoStar":0,"threeStar":1,"fourStar":2,"fiveStar":10}"
I wanted to show this at Create Method
I’ve tried:
<code>$this->crud->addField([
'name' => 'reviewsDistribution',
'label' => 'reviewsDistribution',
'type' => 'table',
'entity_singular' => 'reviewsDistribution', // used on the "Add X" button
'columns' => [
'key' => 'Key',
'value' => 'value',
],
'max' => 5,
'min' => 1,
]);
</code>
<code>$this->crud->addField([
'name' => 'reviewsDistribution',
'label' => 'reviewsDistribution',
'type' => 'table',
'entity_singular' => 'reviewsDistribution', // used on the "Add X" button
'columns' => [
'key' => 'Key',
'value' => 'value',
],
'max' => 5,
'min' => 1,
]);
</code>
$this->crud->addField([
'name' => 'reviewsDistribution',
'label' => 'reviewsDistribution',
'type' => 'table',
'entity_singular' => 'reviewsDistribution', // used on the "Add X" button
'columns' => [
'key' => 'Key',
'value' => 'value',
],
'max' => 5,
'min' => 1,
]);
But I does not shows the values, there is only one row and It’s Empty
Also, if i fill this rows it gives me then, in a later page an error:
<code>htmlspecialchars(): Argument #1 ($string) must be of type string, array given
</code>
<code>htmlspecialchars(): Argument #1 ($string) must be of type string, array given
</code>
htmlspecialchars(): Argument #1 ($string) must be of type string, array given
And in the database there is one array saved
<code>[
{
"star": "s1",
"value": "1"
},
{
"star": "s2",
"value": "2"
}
]
</code>
<code>[
{
"star": "s1",
"value": "1"
},
{
"star": "s2",
"value": "2"
}
]
</code>
[
{
"star": "s1",
"value": "1"
},
{
"star": "s2",
"value": "2"
}
]