ใส่คำสืบค้น
2) { $sql ="SELECT * FROM medias where 1 "; if ($typeid <> "") { $sql= "$sql and (RESOURCE_TYPE = '$typeid')"; } if ($name <> "") { /////////////////////////////////////// $sql= "$sql and ((TITLE like '%$name%') or (DESCRIPTION like '%$name%') or (SUBJECT like'%$name%') or (AUTHOR like '%$name%') or (RESOURCE_IDENTIFIER like'%$name%'))"; } $result = mysql_query($sql,$conn); $NRow = mysql_num_rows($result); $Num = mysql_num_rows($result); $rt = $NRow%$list_page; if($rt!=0) { $totalpage = floor($NRow/$list_page)+1; } else { $totalpage = floor($NRow/$list_page); } $goto = ($page-1)*$list_page; // Query ข้อมูลตามจำนวนที่กำหนด $sql="$sql order by TITLE limit $goto,$list_page"; // $sql = "$sql ORDER BY 'name' ASC"; // echo $sql; $result = mysql_query($sql,$conn); $NRow = mysql_num_rows($result); echo mysql_error(); if($NRow==0) { echo "



Sorry, no results were found

\n"; } // แสดงชื่อข้อมูล else { //หาลำดับที่ if ($page <= 1){ $i = 1; $f = $i; } else { $n = $page * $list_page; $m = $list_page - 1; $i = $n - $m; $f = $i; } ?> "; while($row = mysql_fetch_array($result)){ $mPri = $row[ID]; $mUrl = $row[url]; $callNum = $row[callNum]; $mName = $row[TITLE]; $mUrl = $row[RESOURCE_IDENTIFIER]; $mType = $row[RESOURCE_TYPE]; $ittt = (($page*20)-20)+$i; if ($i % 2 ==1) { echo""; } else { echo""; } //echo ""; // echo""; $r=mysql_query("select * from typename where typeID='$mType' "); $r2=mysql_fetch_array($r); $tmp=strpos("$mUrl","cfm"); if (strpos("$mUrl",".com")!=false) { $mType="HTML"; } if (strpos("$mUrl",".net")!=false) { $mType="HTML"; } //echo "[$tmp]$mUrl"; if (strpos("$mUrl",".pdf")!=false) { $mType="PDF"; } if (strpos("$mUrl",".net")!=false) { $mType="HTML"; } if (strpos("$mUrl",".jpg")!=false) { $mType="PIC"; } if (strpos("$mUrl",".gif")!=false) { $mType="PIC"; } if (strpos("$mUrl",".cfm")!=false) { $mType="HTML"; } if (strpos("$mUrl",".html")!=false) { $mType="HTML"; } if (strpos("$mUrl",".htm")!=false) { $mType="HTML"; } if (strpos("$mUrl",".php")!=false) { $mType="HTML"; } if (strpos("$mUrl",".txt")!=false) { $mType="TXT"; } echo""; echo""; $i++; $s = $i-1; } ?>
 
 
$ittt
$ittt $mType: $r2[descr] 
"; echo"
"; //echo "[$name]"; echo str_replace("$name","$name",$mName); echo " "; if ($row[AUTHOR]!=$row[TITLE]) { echo "/ $row[AUTHOR] "; } echo "
รายละเอียด: "; echo str_replace("$name","$name",$row[DESCRIPTION]); echo "
$mUrl - "; $s="select * from typename where typeID='$row[RESOURCE_TYPE]' "; //echo $s; $r=mysql_db_query($dbname,$s); $r2=mysql_fetch_array($r); echo "[$r2[descr]]"; /* $s="select * from subpic where typeID='$row[subcatpic]' "; $r=mysql_db_query($dbname,$s); $r2=mysql_fetch_array($r); if ($r2[descr]!="") { echo "[$r2[descr]]"; } $s="select * from typeName where typeID='$row[subcatlink]' "; $r=mysql_db_query($dbname,$s); $r2=mysql_fetch_array($r); if ($r2[descr]!="") { echo "[$r2[descr]]"; } */ if ($mType=="PIC") { echo '
Preview Picture'; } echo "

"; ; $sql2 ="SELECT * FROM pics where ID=$mPri"; $result2 = mysql_query($sql2,$conn); $i2=1; while($row2 = mysql_fetch_array($result2)){ $pPri = $row2[ID]; $pUrl = $row2[url]; $txt = $row2[txt]; $sql3 ="SELECT * FROM txt where id='$txt'"; //echo $sql3; $result3 = mysql_query($sql3,$conn); $row3 = mysql_fetch_array($result3); $txt2 = $row3[txt]; echo " [$txt2] "; $i2 = $i2 +1; } echo "
"; // table แสดงเลขหน้า echo "\n"; echo "\n"; echo "
\n"; echo "\t\n"; echo "
\n"; // วนลูปแสดงเลขหน้าทั้งหมด echo"Page :"; $startpage = $page-10; if ($page>10) { $startpage=$page-10; } if ($startpage<=0) { $startpage=1; } if ($startpage > 1) { echo "\tFirst \n"; echo "\tBack \n"; } for($i=$startpage ; $i<$page ; $i++) { echo "\t$i \n"; } echo "\t$page \n"; $totalpage2 = $totalpage-$page; if ($totalpage2>1) { $totalpage2=$page+10; } if ($totalpage2>$totalpage) { $totalpage2=$totalpage; } for($i=$page+1 ; $i<=$totalpage2 ; $i++) { echo "\t$i \n"; } if ($page < $totalpage) { echo "\t Next \n"; echo "\tLast \n"; } echo "
\n"; } } else { echo "



Sorry, no results were found

\n"; } ?>