question about mysql_query

Codes here !

Moderators: macek, egami, gesf

Post Reply
User avatar
ejsexton82
New php-forum User
New php-forum User
Posts: 86
Joined: Mon Jun 04, 2012 10:05 pm
Location: Ankara, Turkey
Contact:

Re: question about mysql_query

Post by ejsexton82 » Thu Jun 07, 2012 10:32 pm

You can use the CONCAT() function:

Code: Select all

$queryPerson = 'SELECT * FROM persons WHERE '
	. sprintf("pFirstName LIKE '%%%s%%' ", mysql_real_escape_string($searchQuery))
	. sprintf("OR pLastName LIKE '%%%s%%' ", mysql_real_escape_string($searchQuery))
	. sprintf("OR CONCAT(pFirstName,' ',pLastName) LIKE '%%%s%%';", 
		mysql_real_escape_string($searchQuery));

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests