001.
<div style=
" float: right; margin-right: 55px;"
>
002.
003.
<form name=
"frmSearch"
method=
"post"
action=
"<?=$_SERVER['SCRIPT_NAME'];?>"
>
004.
<table width=
"500"
border=
"0"
align=
"right"
>
005.
<tr>
006.
<th>Search
for
Publications
007.
<select name=
"ddlSelect"
id=
"ddlSelect"
>
008.
<option value=
"incat"
<?
if
(
$_POST
[
"ddlSelect"
]==
"Catagory"
){
echo
"selected"
;}?>>Catagory</option>
009.
<option value=
"indate"
<?
if
(
$_POST
[
"ddlSelect"
]==
"Date"
){
echo
"selected"
;}?>>
Date
</option>
010.
<option value=
"intitle"
<?
if
(
$_POST
[
"ddlSelect"
]==
"Title"
){
echo
"selected"
;}?>>Title</option>
011.
</select>
012.
013.
<input name=
"txtKeyword"
type=
"text"
id=
"txtKeyword"
value=
"<?=$_POST["
txtKeyword
"];?>"
>
014.
<input type=
"submit"
value=
"Search"
></th><tr height=
"20"
><td></td></tr>
015.
016.
</table>
017.
</form>
018.
019.
<?
020.
if
(
$_POST
[
"txtKeyword"
] !=
""
)
021.
{
022.
023.
$strSQL
=
"SELECT * FROM insight WHERE 1 "
;
024.
if
(
$_POST
[
"ddlSelect"
] !=
""
and
$_POST
[
"txtKeyword"
] !=
''
)
025.
{
026.
$strSQL
.=
" AND ("
.
$_POST
[
"ddlSelect"
].
" LIKE '%"
.
$_POST
[
"txtKeyword"
].
"%' ) "
;
027.
}
028.
029.
030.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
031.
$Num_Rows
= mysql_num_rows(
$objQuery
);
032.
033.
034.
$Per_Page
= 2;
035.
036.
$Page
=
$_GET
[
"Page"
];
037.
if
(!
$_GET
[
"Page"
])
038.
{
039.
$Page
=1;
040.
}
041.
042.
$Prev_Page
=
$Page
-1;
043.
$Next_Page
=
$Page
+1;
044.
045.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
046.
if
(
$Num_Rows
<=
$Per_Page
)
047.
{
048.
$Num_Pages
=1;
049.
}
050.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
051.
{
052.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
053.
}
054.
else
055.
{
056.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
057.
$Num_Pages
= (int)
$Num_Pages
;
058.
}
059.
060.
061.
$strSQL
.=
" order by inid ASC LIMIT $Page_Start , $Per_Page"
;
062.
$objQuery
= mysql_query(
$strSQL
);
063.
064.
?>
065.
066.
<br /><br />
067.
<?
068.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
069.
{
070.
071.
$fdname
=
$objResult
[
"incat"
];
072.
$fddatebook
=
$objResult
[
"indate"
];
073.
$fdtitle
=
$objResult
[
"intitle"
];
074.
$fdlink
=
$objResult
[
"inlink"
];
075.
$fddescription
=
$objResult
[
"indetail"
];
076.
$fdfilesname
=
$objResult
[
"filesname"
];
077.
?>
078.
<table border=
"0"
width=
"650px;"
cellspacing=
"1"
cellpadding=
"1"
align=
"top"
>
079.
<tr>
080.
<td width=
"60"
rowspan=
"4"
><?
echo
"<a href=\"$fdlink\" target=\"_blank\"><img src=\"insight/$fdfilesname\" width=\"60px;\" height=\"90px;\" border=\"1\" align=\"top\"
></a></div></td>
081.
<td width=\
"361\"
></td></tr>
082.
<tr><td > </td></tr>
083.
<tr><td ></td></tr>
084.
<tr><td><span style=\
" font-weight: bold; \">$fdname </span> <br /><span>$fddatebook</span> <br /><span class=\"insighttext\" style=\" font-weight: bold; font-style: italic;\"><a href=\"$fdlink\" target=\"_blank\"
>
$fdtitle
</a></span></td></tr>
085.
<tr><td></td>
086.
<td><span style=\
"margin: 0px; padding: 0px;\">$fddescription</span></td></tr><br /><br />"
; ?>
087.
088.
089.
<?
090.
}
091.
?>
092.
</table>
093.
<br>
094.
Total <?=
$Num_Rows
;?> Record : <?=
$Num_Pages
;?> Page :
095.
<?
096.
if
(
$Prev_Page
)
097.
{
098.
echo
" <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_POST[txtKeyword]'><< Back</a> "
;
099.
}
100.
101.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
102.
if
(
$i
!=
$Page
)
103.
{
104.
echo
"[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_POST[txtKeyword]'>$i</a> ]"
;
105.
}
106.
else
107.
{
108.
echo
"<b> $i </b>"
;
109.
}
110.
}
111.
if
(
$Page
!=
$Num_Pages
)
112.
{
113.
echo
" <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_POST[txtKeyword]'>Next>></a> "
;
114.
}
115.
116.
}
117.
?>