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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:36:52+00:00 2026-06-10T07:36:52+00:00

I have a search box where users can search for other users in a

  • 0

I have a search box where users can search for other users in a few types of ways, firstname, lastname, username or email within a drop down. This drop down shows the top 8 results and then I show a link at the bottom saying find more results with the bit of text they may have inputted into the search.

So for instance if I type in JOHN but only type ‘JO’ of his name this is the value $_GET[‘t’] should send through to the searchresults page. So I got as far as the link. But I just don’t know what the query should be

Show more results link

<a href='include/searchresults.php?ref=".$_GET['t']."'>Show More Results for ".$_GET['t']."</a>

SEARCHRUSULTS.PHP

    if(isset($_GET['t'])){
$_GET['t'] = str_replace(" ", "", $_GET['t']);
$_GET['t'] = str_replace("%", "", $_GET['t']);

$_GET['t'] = mysqli_real_escape_string($mysqli,$_GET['t']);

if(strlen($_GET['t'])>1){

$sql="SELECT * FROM users WHERE username LIKE '%".$_GET['t']."%' OR first LIKE '%".$_GET['t']."%' OR last LIKE '%".$_GET['t']."%' OR email LIKE '%".$_GET['t']."%' ORDER BY first ASC";
$query=mysqli_query($mysqli,$sql);
$count = mysqli_num_rows($query); 

    if($count<=0){
        echo "No results found";
    }else{
    echo "<table width='100%'>";
        while($user_data=mysqli_fetch_array($query)){}
  • 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-10T07:36:53+00:00Added an answer on June 10, 2026 at 7:36 am

    Try something like this, using MATCH insted of LIKE is much faster.

    $keyword=mysql_real_escape_string($_GET['t']);
    $rowsperpage=8;
    $sql="SELECT * FROM users WHERE MATCH (first, last, email) AGAINST ('+$keyword*' IN BOOLEAN MODE)   ORDER by first LIMIT $rowsperpage"; 
    $query=mysqli_query($mysqli,$sql);
    $count = mysqli_num_rows($query); 
    

    and set $rowsperpage as you like.

    For more result page do something like this

    $rowsperpage=mysql_real_escape_string($_GET['rpp']);
    <a href='include/searchresults.php?t=$keyword&rpp=$rowsperpage'>Show More Results for "$keyword"</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a search box that users can type terms into. I have a
I have the following problem: I have a search box in which user can
I have created an HTML form with a search box and a drop down
In my jsp application I have a search box that lets user to search
I have a popup search box that is shown when the user mouses over
I have a search box on my site and i need to replace all
I have a search box on my site. If a student enters some text,
I have a search box and search button. I want to call a javascript
I have a simple search box that it hidden until hover(over) and hides again
I have an edit text which functions as a search box in my application.

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.