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..
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..

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.