Jump to content

combining multiple database fields in 1 returned field


otual

Recommended Posts

I'm fairly new to PHP and mySQL, and I am creating a database driven website. I am trying to create a search function that quickly searches for a particular string. I have several tables with multiple text fields, what i was hoping to do is return the UserID number as 1 column and certain text fields from various tables concatinated as another column. That way I can group together all the relevant information and use LIKE to search for the string... Other than that I guess I have to perform multiple searches and keep track of all the matches..
Link to comment
Share on other sites

I actually solved my own problem about 5 mins after sending this request for help...

I used the function concat in my SQL statement to check for the textstring...

[color=navy]select UserNo from UserList where concat(Street,' ',Suburb,' ',State) like '%[color=red][i]$inputstring[/i][/color]%'[/color]

This produced satisfactory results for the desired search..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.