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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:18:39+00:00 2026-06-05T20:18:39+00:00

I have a mySQL database with a FirstName and LastName column and presently i

  • 0

I have a mySQL database with a FirstName and LastName column and presently i have a search query searching for Lastnames, and When the LastNames match they are echoed on screen along with the FirstName from it’s row, Now thats great, what i will like to find out is how can a make the query search for FullNames that are typed into the input feild, keep in mind that i do not have a FullName column the full name will be what the user types in, bellow is an example of what I presently have working! Thanks.

if(isset($_GET['name'])){   
    $raw_name=$_GET['name'];

    if(preg_match("/[A-Z | a-z]+/", $raw_name)){        
        $name=$raw_name;        
        include "connect.php";      
        //-query the database table
        $sql="SELECT userId, FirstName, LastName FROM residential2 WHERE FirstName='" . $name   ."'";
        //-run the query against the mysql query function
        $result=mysql_query($sql);
        //-count results
        $numrows=mysql_num_rows($result);

        echo "<div align=\"center\">" . $numrows . " results found for " . stripslashes($name) . "</div>";

        while($row=mysql_fetch_array($result)){         
            $FirstName =$row['FirstName'];
            $LastName=$row['LastName'];
            $userId=$row['userId']; 
            //-display the result of the array
            echo "<ul>\n"; 
            echo "<li>" . "<a href=\"index.php?id=$userId\">" . $LastName . " "  .$FirstName . "   </a></li>\n";
            echo "</ul>";
        }
    }
    else {      
        echo "<p>Please enter a search query</p>";
    }
}
  • 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-05T20:18:40+00:00Added an answer on June 5, 2026 at 8:18 pm

    Use concat()

    $sql="SELECT userId, CONCAT(FirstName, ' ', LastName) AS fullname FROM residential2 WHERE FirstName='" . $name   ."'";
    
    <?php
        $fullname = $row['fullname']; 
    ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL database and a table which has a names column as
So I have a database setup in MySQL with three columns. The first column
I currently have a MySQL database that I am accessing using PHP. You search
I have mysql database and I want a software which can draw the database
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a MySQL database, and a particular table in that database will need
I have a MySQL database with multiple tables, each of which have the same
I have a mysql database of entries with dates. So what I want is
I have a MYSQL database. Text is currently stored in charset latin1 , collation
I have a mysql database that is tracking hockey stats. What I'd like to

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.