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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:43:53+00:00 2026-06-05T04:43:53+00:00

i have mysql table, users: (id, first_name, last_name, ….) i’d like to do something

  • 0

i have mysql table, users: (id, first_name, last_name, ….)

i’d like to do something like this pseudo query

SELECT * FROM users WHERE first_name.' '.last_name = 'john doe' LIMIT 10")

I Want to do this cause i have lots of trouble spliting the string (then i don’t know in what order is user typing’

This is my current, not working very good

$phrase = explode(' ',$term);
$last_name = '';
if($phrase[1] != '')
    $last_name= " OR last_name LIKE '%".$phrase[1]."%'";
$qstring = "SELECT usuarios.first_name,usuarios.last_name,
                    usuarios.id as id
            FROM usuarios
            WHERE first_name LIKE '%".$phrase[0]."%' OR last_name LIKE '%".$phrase[0]."%' $last_name LIMIT 5";

Any suggestion to achieve this (by concatenating at query or spliting at php) would be very apreciated

  • 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-05T04:43:55+00:00Added an answer on June 5, 2026 at 4:43 am

    You can concatenate in a MySQL query using CONCAT:

    SELECT * FROM users WHERE CONCAT(first_name,' ',last_name) = 'john doe' LIMIT 10
    

    In your code this would become:

    SELECT * FROM usuarios WHERE CONCAT(first_name,' ',last_name) LIKE '%{$phrase[0]}%' LIMIT 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have the following query/table from a local bookstore $queryadmin =SELECT last_name, first_name,
I've tried this: SELECT first_name,last_name,company_name FROM users ORDER BY last_name, company_name ASC I have
Lets say I have a MySQL table, Users, like this - ----------------------------------------- ID |
I have MySQL database with two tables: users and items. They look like this:
I have a user table with columns named first_name and last_name . SELECT *
I have a MySQL table called Users. The rows have 4 fields and look
So I have a mySQL database with a 'users' table which includes a username,
using php and mysql I have two tables, a users table and a profiles
I have names stored in my mysql database i created a table called users
I have a mysql table jobs . This is the basic structure of jobs

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.