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

  • SEARCH
  • Home
  • 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 3956284
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:20:36+00:00 2026-05-20T02:20:36+00:00

I have a course page, this page is setup to display the details (easy),

  • 0

I have a course page, this page is setup to display the details (easy), then who is teaching it first, second, third, and forth period of each semester. The problem with that is, my teachers data is handled in one giant chain.

Bobby: 1-1-1-1-1-1-1-1

Tina: 20-20-20-10-1-1-1-1

Joey: 20-1-1-1-49-432-10-19

What I want to do is find a course: 20, when all of the information is shown a search through teachers would be made to find out who is teaching course 20 and what period?

Ex.

Course id: 20
Period 1: Joey, Tina
Period 2: Tina
Period 3: Tina

I want to get every teacher teaching that course in one search but given the obstacle of the capact data which may be a problem.

Teacher Table:
id / name / link / course (1-1-1-1-1-1-1-1)

Course Table:
id / name / code / grade / level

Teachers Course contains the id’s from course Table

  • 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-05-20T02:20:37+00:00Added an answer on May 20, 2026 at 2:20 am

    While re-structuring your db might be the best answer, I thought I’d post a straight php solution that works with your current structure and presumptively the rest of your code.

    //I set up variables to contain your expected search results so I could test
    $search_course = '20';
    $search_results = array(
        'Bobby' => '1-1-1-1-1-1-1-1',
        'Tina' => '20-20-20-10-1-1-1-1',
        'Joey' => '20-1-1-1-49-432-10-19'
        );
    
    //explode the course strings into arrays and store with teacher names so 
    //you can loop through them later   
    foreach($search_results as $teacher=>$string_courses){
        $array_courses = explode('-',$string_courses);
        $search_results[$teacher] = $array_courses;
        }
    
    //Match course you are searching for to the elements in your array
    //Create a result array with period and matching teachers
    foreach($search_results as $teacher=>$courses){
    foreach($courses as $period => $course){
        if($course == $search_course){
                $results[$period][] = $teacher;
                }
            }
        }
    
    //Loop through your result array and show the results
    //I expect you'll have different html for this
    foreach($results as $period => $teachers){
        echo 'Period: ';
        echo $period+1;
        echo implode(',',$teachers);
        echo '<br>';
    }
    

    The printed results match the list you wanted in your OP

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

Sidebar

Related Questions

I have a catch-all route setup in ASP.NET MVC, so I can capture /this-page,
I have this select on a page: <select multiple= class=recipientsList name=Recipients[] id=To style=display: none;>
I have a page setup like so: <ajax:UpdatePanel id=UpdatePanel1 runat=server UpdateMode=Conditional> <ContentTemplate> <asp:TextBox id=TextBox1
I'm attempting to setup a MenuItem that will have a submenu of page numbers
This is weird. I have a virtual directory setup for an MVC3 application called
I have a Page in a Windows Phone class library. This page has an
I have this page in a Liferay 6.0.5 portal which contains of a looong
For example I have a website that points to a page like this: http://www.mysite.com/folder/file
I have Course's model and the course consist of several file (stored only link
i have a course project to do on network security, the project theme is

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.