CodeIgniter Forums
how to get string from database and how to explode it in codeigniter? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: how to get string from database and how to explode it in codeigniter? (/thread-71226.html)



how to get string from database and how to explode it in codeigniter? - jaydevvara - 07-21-2018

Here is my code i tried to explode string, but get some errors, i got string but i did not explode, Here i getting some erros,i cant understand it A PHP Error was encountered
Severity: Warning
Message: explode() expects parameter 2 to be string, object given
Filename: views/testing.php
Line Number: 65
Here is My code:

Code:
 <?php

                                   foreach ($test as $t)  
                               {
                                     echo  $user_rights=$t;
                                       $t=(explode(",", $t));                                  


                                   }

                                   ?>



RE: how to get string from database and how to explode it in codeigniter? - Pertti - 07-21-2018

Is $test the DB query result?

In that case $t also needs database column - $t->user_rights


RE: how to get string from database and how to explode it in codeigniter? - jaydevvara - 07-22-2018

(07-21-2018, 06:27 AM)Pertti Wrote: Is $test the DB query result?

In that case $t also needs database column - $t->user_rights

oh yes got it, Thank you


RE: how to get string from database and how to explode it in codeigniter? - Pertti - 07-23-2018

(07-22-2018, 09:26 PM)jaydevvara Wrote: oh yes got it, Thank you

No worries Smile


RE: how to get string from database and how to explode it in codeigniter? - jaydevvara - 07-23-2018

(07-23-2018, 12:28 AM)Pertti Wrote:
(07-22-2018, 09:26 PM)jaydevvara Wrote: oh yes got it, Thank you

No worries Smile
 just now i posted new question can you help me please?