I have some trouble here.. I hope somebody could help me.
so let me explain first
Lets say i have this table
idBarang | idAttribute | Value
----------------------------------
1 | 2 | A
2 | 2 | B
3 | 2 | B
4 | 2 | C,D
And then i have this Query Code
select * from relation_barang where idAttribute = '2' GROUP BY value limit 0,20
My Problem Is, try too look the var_dump of my query result object
array(2) {
[0]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "1"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(14) "A"
}
{
[1]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "2"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(1) "B"
}
[1]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "4"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(1) "C,D"
}
}
And what wanted is something Like this
array(2) {
[0]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "1"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(14) "A"
}
{
[1]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "2"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(1) "B"
}
[2]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "4"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(1) "C"
}
[3]=>
object(stdClass)#4 (5) {
["idBarang"]=>
string(1) "4"
["idAttribute"]=>
string(1) "2"
["value"]=>
string(1) "D"
}
}
I try to searching on google but cant find the solution
how to do that? did anyone knows how to do that? im really confused here.. anyone experts help me please,,, thanks