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 7520991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:09:42+00:00 2026-05-30T02:09:42+00:00

We need to create a program in PHP/MySQL that will display all the ‘people’,

  • 0

We need to create a program in PHP/MySQL that will display all the ‘people’, who have certain skill/s that may be needed during an event. Each person has at least a skill and with a rating of 1 – 5 depending on how skilled is that person for a specific skill. For example, John have 2 skills – painting and drawing. He is expert in painting so his rating for painting is 5 while rating of only 2 for drawing, for he can draw but not very good.

There are events that the admin can add, which contains the needed skills for that specific event. Each event will contain skills from only one to eight different skills. For example, the user will create an event called Art Class Tutorial and will then select from the pre-defined skills (provided by the program) which skills are needed for it. In this case for example, the admin selects Sculpting, Drawing and Painting. Next, the admin will need to find all the ‘people’ with the skills Sculpting OR Drawing OR Painting (so that they can participate in teaching in the event), in which ratings should not be below 3.

In this case, John should be displayed because he has a 5-star rating for painting even if his drawing is just 2-star. If for example, Bob has sculpting, drawing and painting but all of them have a rating of 2-star, Bob should not be displayed.

So my problem is this: how can I create a query for this since the program does not know how many skills an event needs and which skills are chosen? The combination of possibilities are too many for me to create if’s for each possible combination.

By the way, in my table for each ‘person’, there exist the eight fields (one for each skill) which should contain each skill rating per skill. Rating 0 means not skill in that area.

Here is my current code on this:

function search_results($keywords){
   $returned_results = array();
   $where = "";

   $keywords = preg_split('/[\s]+/', $keywords);
   $total_keywords = count($keywords);

   foreach($keywords as $key=>$keyword){
      $where .= "`keywords` LIKE '%$keywords%'";
      if($key != ($total_keywords - 1)){
         $where .= " AND ";
      }
   }
$results = "SELECT `title`, LEFT(`description`, 70) as `description` , `url` FROM `articles` WHERE $where";
$results_num = ($results = mysql_query($results)) ? mysql_num_rows($results): 0;

if($results_num === 0){
   return false;
}else{

   while($results_row = mysql_fetch_assoc($results)){
      $returned_results[] = array(
      'title' => $results_row['title'],
      'description' => $results_row['description'],
      'url' => $results_row['url']

    );
}
return $returned_results;
  • 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-30T02:09:42+00:00Added an answer on May 30, 2026 at 2:09 am

    Simply do that:

    • Create onto your database some entities like: event,skill,people.
    • Previous tables have to be related with foreign key(s); So you’ll probably have to build some “intermediate” entities (think to event/skill cardinality and skill/people).
    • Now you can, for every event, query the DB an dinamically extract how many skills have to considered for that particular event
    • At this point, you can create dinamically a string for your WHERE condition
    • The trick is done

    Hope it is clear and will help you

    Edit (under question’s author request)

    Intermediate entities are “special” entities that have to be created when you have a relationship of n/m between two entities (or table, if you prefer refer to those in that way). So, if ‘event’ and ‘skills’ have a m/n cardinality (and they have!) you have to create a table (say r_event_skills) where the PK of ‘r_event_skills’ is composed by combination of two foreign keys (one that is constrained to event’s PK, the other constrained with skill’s PK).
    Now, you have to repeat the same for skill/people and the trick is done.

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

Sidebar

Related Questions

I need to create an installer program that will do install the following: ASP.Net
I would need to create a php file that will do some work on
I need to create program that creates a XML schema like below using System.Xml.XmlSchema
I need a program that create a web-like environment (like easyphp does) but without
I need to create a program that has access to HKLM when running in
I would need to create a program that only install SQL Express and install
For a school project I need to create a program and it'd be nice
I need my program to create and edit a config file, which would contain
My current program need to use programatically create a XPathExpression instance to apply to
I was trying to create a lzw compression program. But i need to finish

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.