question about mysql_query

Codes here !

Moderators: egami, macek, 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:

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
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest