Welcome Guest, Not a member yet? Register   Sign In
How to get two different result in joined table CI4 with default ID
#1

(This post was last modified: 01-25-2022, 12:53 AM by luckmoshy.)

Hi guys Here have joined table (accommodationtable and icons table) work fine
  I want to fetch results with different call
         
 
PHP Code:
  foreach($AccommodationModel as $listAccommodationItems){/*"1,2,3,"*/

and
PHP Code:
  foreach($AccommodationModel as $listicons){/*"1,2,3,"*/

but is not work why? I get this error  (Cannot access offset of type string on string )

I mean to get data from accommodation and icons table separately  but with one id (joined)

         
PHP Code:
  

/*This is the last view page mean to read a full articles*/
/*here not work*/
 
public function view($slug null,)
{
         $AccommodationModel = new AccommodationModel();
  $data=[
/*mult-array data--------------.......*/
    'AccommodationModel' => $AccommodationModel
    
->join('icons''icons.id =accommodationtable.accommodation_id')
    ->getAccommodationItems($slug),
];
return 
view('accommodation_view_all',$data);/*from read more */


But in customer function works in the wildcard, it is not works
PHP Code:
  


 
public function costmerFunction ()
{
    /*here it works ok*/

         $AccommodationModel = new AccommodationModel();
$data[
    'AccommodationModel' => $AccommodationModel
 
->join('icons''icons.id =accommodationtable.accommodation_id')
 ->
getAccommodationItems(),
];
return 
view('accommodation_view_all',$data);





I have directed cause of error  this function view is the last call for the page  I don't know how can I fetch data from accommodation table and icons table to get the same table joined id  because if I call table id with different id (not joined) it can't because it shows accommodation table with different rows but for icons table, it shows only the same and all data rows in every view page instead of  different rows
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#2

Sorry, I don't get what you say.
Show your MVC code, if you do, someone might answer something.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB