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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:26:43+00:00 2026-05-25T15:26:43+00:00

Everything pretends to work great, except when I Search for anything I get no

  • 0

Everything pretends to work great, except when I Search for anything I get no results with no errors. I think my issue is within my query, but I can seem to pinpoint it. I have made some searches before, but only linking 2 tables. Now that I am trying to Link 4 tables, it got pretty complicated. I would like to get a clarification on what I may need to adjust to clear this mess up.

    <?php


$search = $_GET['search'];


if (!$search) 
echo "You didn't enter a keyword";
else
{
  echo "<td>You searched for: <strong>$search </strong></td><br><br>";
  mysql_connect('localhost','myuserexample','mypassexample');
  mysql_select_db('spusers');  
  $id=@$_GET['id'];


  $query="
        SELECT
            spusername.id, spusername.firstname, spusername.lastname, spusername.splocation_id,
            sptraining.id, sptraining.trainingtype, sptraining.level,
            splocation.id, splocation.location,
            sprecord.spusername_id, sprecord.sptraining_id

        FROM spusername 
        JOIN sprecord ON spusername.id = sprecord.spusername_id
        JOIN sptraining ON sprecord.sptraining_id = sptraining.trainingtype
        JOIN splocation ON spusername.splocation_id = splocation.location
        WHERE MATCH ( firstname, lastname, trainingtype, level, location, spusername_id, sptraining_id, splocation_id ) 
        AGAINST('%".$search."%' IN BOOLEAN MODE) ORDER BY lastname ASC";

  $result1 = MySQL_query($query);  
  if(!$result1) {  
    echo MySQL_error()."<br>$query<br>";
  }  
  if (MySQL_num_rows($result1) > 0) {
    echo "<table class='sortable' width='750' align='center' border='1' bordercolor='#000000' bgcolor='#000000'
           cellspacing='2' cellpadding='2'><tr><th bgcolor=#999999>
           Employee</th><th bgcolor=#999999>
           Location</th><th bgcolor=#999999>
           Training</th><th bgcolor=#999999>
           Level</a></th><th bgcolor=#999999>
           Date Completed</th></tr bgcolor=#999999>";
    while($result2 = MySQL_fetch_array($result1)) {


      echo  "<td bgcolor=#d4d5ff>{$result2['lastname']},
            {$result2['firstname']}</td><td bgcolor=#d4d5ff>
            {$result2['location']}</td><td bgcolor=#d4d5ff>
            {$result2['trainingtype']}</td><td bgcolor=#d4d5ff>
            {$result2['level']}</td></tr>";
    }
    echo "</table>";
  } else {
    echo "No Results were found in this category.<br>";
  } 
  echo "<br>";
}
?>
  • 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-25T15:26:44+00:00Added an answer on May 25, 2026 at 3:26 pm

    Resolved…

    instead of

    JOIN sptraining ON sprecord.sptraining_id = sptraining.trainingtype
    JOIN splocation ON spusername.splocation_id = splocation.location

    I mistakenly said it equaled the trainingtype and location instead of id.

    example of it working:
    JOIN sptraining ON sprecord.sptraining_id = sptraining.id
    JOIN splocation ON spusername.splocation_id = splocation.id

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

Sidebar

Related Questions

Everything in my code works but $num_results... Book-O-Rama Search Results Book-O-Rama Search Results //create
Everything below works fine, except that the form doesnt get submitted... it seems the
Everything is in the title. I've been looking for hours how to get a
Everything was working fine before upgrading but now I can't run rake tasks.. any
Everything is OK in Chrome, FF and IE8. But in IE6 there's a strange
Everything is in the title, I would like to start a session at work
Everything builds and runs in the simulator fine ... but when I attempt to
Everything is working fine in 3g mode the advertisement is correctly shown but as
Everything in nodejs is non-blocking which is nice, but how would I go about
I know this is a common question but I just can't seem to get

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.