1
BEGIN
2
PREPARE STMT FROM
3
"Select ClientID, Name, Address1, Address2, City, State, Zip, Phone, Fax, Comment, Last_User, Country
4
from clients
5
Where (
6
ClientID like CONCAT('%', ?, '%') or
7
Name like CONCAT('%', ?, '%') or
8
Address1 like CONCAT('%', ?, '%') or
9
Address2 like CONCAT('%',?, '%') or
10
City like CONCAT('%', ?, '%') or
11
State like CONCAT('%', ?, '%') or
12
Zip like CONCAT('%', ?, '%') or
13
Phone like CONCAT('%', ?, '%') or
14
Fax like CONCAT('%', ?, '%') or
15
Comment like CONCAT('%', ?, '%') or
16
Last_User like CONCAT('%', ?, '%') or
17
Country like CONCAT('%', ?, '%')
18
) and clientid in (Select clientid From UserSec Where UserID=?)
19
order by Name ASC
20
LIMIT ?,?";
21
SET @LIMIT = (page * pagesize) - pagesize;
22
SET @size = pagesize;
23
SET @s = search;
24
SET @U = userid;
25
EXECUTE STMT USING @s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@s,@U,@LIMIT,@size;
26
END