Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:54:02+00:00 2026-06-04T23:54:02+00:00

I have these tables cat (holds main data for categories) id_cat, original name cat_lang

  • 0

I have these tables

cat (holds main data for categories) id_cat, original name
cat_lang (holds cat details in different languages) lang, id_cat,local_name
cat_media (holds cat media) id_cat, id_media, usage (may have base or big)
media (holds image information) id_media, name, path

I made a query which returns sub categories of selected category like this.

$this->db->select('*')
         ->from('cat')
         ->join('cat_lang','cat.id_cat = cat_lang.id_cat','left outer')
         ->join('cat_media','cat.id_cat= cat_media.id_cat','left outer')             
         ->join('media','cat_media.id_media=media.id_media','left outer')
         ->where('cat.id_parent',$id_cat) //comes from function             
         ->where('cat_lang.lang',$lang)
$query = $this->db->get();

I will filter the big images after then with:

  $sub_cats = $query->result_array(); 
  $data['sub_cats']= array();
  foreach($sub_cats as $key => $value)
  {
    if($value['usage'] == 'base' OR $value['usage'] == null)
    $data['sub_cats'][] = $value;
  }

$value['usage'] == null is where the trouble begins. Problem is in some categories, there is not attached base image and above query does not return this categories because it did not match in cat.id_cat= cat_media.id_cat condition.

I want to get in result table:

id_cat:1 , ..., id_media = 2, usage=big
id_cat:2 , ..., id_media = null, usage=null

So I need them in the result table as null. How can I do that? Stacked here for hours. Thanks for any help..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:54:04+00:00Added an answer on June 4, 2026 at 11:54 pm

    I realized that I am trying something which is not possible.
    Trying to get categories which has image attached, but also asking which are no image attached as well. I make sure that while creating a category I am attaching a default no-preview image now, now query does the job. Thanks for answers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:
I have these two tables people ============ id, name and answer_sheets ============ id, person_id,
I have two tables entries(id,name,desc,cat_id) and categories(id,name,parent) entries.cat_id and categories.id are FK and between
Suppose I have two tables: zoo_tbl name ------ dog cat monkey lion tiger elephant
I have two tables namely 'categories' & 'products' as follows: categories id | name
I have these 3 tables + data: items : itemId, itemName data: 1, my
Say you have 3 tables.. articles(id,id_cat) categories(id) messages(id,id_cat,id_article) ..where articles is related with categories
I have the following tables: CATEGORIES -- entry_id, cat_id TITLES -- entry_id, title DATA
I have aSQLite3 database with three tables. Sample data looks like this: Original id
I have these tables: comments uid id pid pages pid user users id rank

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.