01.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=tis-620"
>
02.
<?
03.
$servername
=
"xxx"
;
04.
$databasename
=
"xxx"
;
05.
$user
=
"sa"
;
06.
$pass
=
"xxx"
;
07.
$connection_string
=
"DRIVER={SQL Server};SERVER=$servername;DATABASE=$databasename;AutoTranslate=no"
;
08.
$cid
= odbc_connect(
$connection_string
,
$user
,
$pass
)
or
die
(
"?NotCONNECT"
);
09.
$q
= urldecode(
'utf-8'
,
'tis-620'
,
$_GET
[
"q"
]);
10.
$sql
=
"SELECT * FROM pd_inv WHERE (pd_nambill LIKE '%"
.
$_GET
[
"q"
].
"%')"
;
11.
$results
= odbc_exec(
$cid
,
$sql
)
or
die
(
"Error Execute ["
.
$sql
.
"]"
);
12.
while
(
$row
= odbc_fetch_array(
$results
)) {
13.
$id
=
$row
[
"pd_cod"
];
14.
$name
=
$row
[
"pd_nambill"
];
15.
$name
=
str_replace
(
"'"
,
"'"
,
$name
);
16.
$display_name
= preg_replace(
"/("
.
$q
.
")/i"
,
"<b>$1</b>"
,
$name
);
17.
echo
"<li onselect=\"this.setText('$name').setValue('$id');\">$display_name</li>"
;
18.
}
19.
odbc_close(
$cid
);
20.
?>