Query to json - HELP |
[eluser]Near[/eluser]
Hi! I have a table named product containing this value p_id | p_name | p_quantity 1 p1 10 2 p2 20 3 p1 5 4 p1 6 how would i get the records like this? p1 [10,5,6] p2 [20] and then convert it to json.. Thanks!
[eluser]ojcarga[/eluser]
I don´t know if that is possible, but I´d do it this way, Code: $this->output array('foo' => 'bar') is the array containing the data retrieved from the database. http://ellislab.com/codeigniter/user-gui...utput.html
[eluser]Near[/eluser]
[quote author="CroNiX" date="1335896855"]Look into MySQLs group_concat() function.[/quote] hi thanks! Group_concat do the trick on my problem. I thought i need to use json on that. Anyways! Thanks again.. |
Welcome Guest, Not a member yet? Register Sign In |