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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:20:32+00:00 2026-05-24T16:20:32+00:00

I am building a mini test php thing. And I need to be able

  • 0

I am building a mini test php thing. And I need to be able to search the results. This works great. But I cannot seem to make a paging system around this. I sort of know how to make a paging system, however, I cannot seem to do this because the mysql query is not only searching the table records which idedu_details is equal to $edu_details:

$search_result = mysql_query("SELECT * FROM test WHERE idedu_details='".$edu_details."' AND first_name LIKE '%".$search."%' OR surname LIKE '%".$search."%'");

here is my complete code:

$search_result = mysql_query("SELECT * FROM test WHERE idedu_details='".$edu_details."' AND first_name LIKE '%".$search."%' OR surname LIKE '%".$search."%'");

    while($row_search = mysql_fetch_array($search_result)){


                $idedu_detail_check = mysql_query("SELECT * FROM test WHERE idtest='".$row_search['idtest']."'") or die(mysql_error());
                $row_idedu_check = mysql_fetch_array($idedu_detail_check);

                if($row_idedu_check['idedu_details'] == $edu_details){
                $testid = $row_search['idtest'];
                $firstName = $row_search['first_name'];
                $surname = $row_search['surname'];
                $dob = $row_search['dob'];
                $date = $row_search['date'];
                $status = $row_search['status'];
                $link = "report.php?id=$testid";
                $button = '<button onClick="parent.location='. "'".$link."'".'">Analyse</button>';

                echo "<tr>
                    <td width='100'>$firstName</td>
                    <td width='100'>$surname</td>
                    <td width='100'>$dob</td>
                    <td width='100'>$date</td>
                    <td width='100'>$status</td>
                    <td width='100'>$button</td>

                    </tr>";
                }//end if idedu_detail check

            }//end while

        }//end else search != null

How can I make a paging system around this?

EDIT: I know how to make a general paging system. However, checking the ided_details = $edu_details and building a paging system around this is causing an issue.

  • 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-24T16:20:34+00:00Added an answer on May 24, 2026 at 4:20 pm

    I think you forgot to add parenthesis in WHERE clause:

    $search_result = mysql_query("
        SELECT * 
        FROM test 
        WHERE 
            idedu_details='".$edu_details."' AND 
            ( first_name LIKE '%".$search."%' OR surname LIKE '%".$search."%' )
    ");
    

    Keep in mind that AND always takes precedence over OR.

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

Sidebar

Related Questions

Building a website. When I order my tags like this, LightCycle works but Lightbox
Building a file open dialog replacement. Much of it works now, but I would
building upon the $.fn.serializeObject() function from this question , i'd like to be able
I'm building a SharePoint mini-client. I need to show a list of folders and
I'm building a custom mini-cms using PHP. I'm currently using the common technique of
I'm building a mini news CMS where the news added are sorted using a
building a site using PHP and MySQL that needs to store a lot of
building libraries with waf is nice and I like the lib<targetname> naming scheme. But
Building on this question , is there a simple solution for having a multi-key
Building a relatively simple website, and need to store some data in the database

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.