1
BEGIN
2
PREPARE STMT FROM
3
"Select a.LocationID, b.Name, a.Name, a.Address, a.City, a.State, a.Zip, a.Phone, a.Fax, a.ClientID from Locations a, Clients b where a.clientid = b.clientid and
4
(
5
a.LocationID like concat('%',?,'%') or
6
b.Name like concat('%',?,'%') or
7
a.Name like concat('%',?,'%') or
8
a.Address like concat('%',?,'%') or
9
a.City like concat('%',?,'%') or
10
a.State like concat('%',?,'%') or
11
a.Zip like concat('%',?,'%') or
12
a.Phone like concat('%',?,'%') or
13
a.Fax like concat('%',?,'%')
14
) and a.clientid in (Select clientid From UserSec Where UserID=?)
15
order by b.Name ASC, a.Name ASC
16
LIMIT ?,?";
17
SET @LIMIT = (page * pagesize) - pagesize;
18
SET @s = search;
19
SET @size = pagesize;
20
SET @U = userid;
21
EXECUTE STMT USING @s,@s,@s,@s,@s,@s,@s,@s,@s,@U,@LIMIT,@size;
22
END