|
 |
|
link เปิดหน้าครับผ๋ม ปัญหามีอยู่ว่าคลิกลิงค์เปิดหน้าแล้วมันไม่ไปครับไม่รู้ว่าผิดตรงไหน |
|
 |
|
|
 |
 |
|
วานท่านผู้รู้ช่วยดูโค้ดให้หน่อยได้ไหมครับ ปัญหามีอยู่ว่าคลิกลิงค์เปิดหน้าแล้วมันไม่ไปครับไม่รู้ว่าผิดตรงไหน 
<?php
include "connect.php";
$sql = "select * from search where title like '%$keyword%'";
$result1 = mysql_db_query($dbname, $sql);
$Num_Rows = mysql_num_rows($result1);
$Per_Page = 6; // Per Page ให้แสดงต่อหน้า
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$sql = "select * from search where title like '%$keyword%' LIMIT $Page_Start , $Per_Page";
$result = mysql_db_query($dbname,$sql);
$num=mysql_num_rows($result);
if ($num>0) {
echo "<table border=1 cellpadding=5 cellspacing=5 bordercolor='#ffffff'>";
$check=1;
while ($rs = mysql_fetch_array($result)) {
$id = $rs[id];
$title = $rs[title];
$url = $rs[url];
if ($check%3 == 1){
echo "<tr>";
}
echo "
<td width=100 bordercolor='#000000'>
<a href='#mark' onClick=\"window.open('".$url."','_blank','width=900,height=458,scrollbars=no,menubar=no,status=NO,resizable=no,Top=150,Left=30');\" >".$title."</a>
</td>";
if ($check%3==0) {
echo "</tr>";
$check=0;
}
$check++;
}
echo "</table>";
}
?>
//กำหนดการแสดงแล้วก็ linkแบ่งหน้า
<span class="newa">
Total
<?= $Num_Rows;?>
Record :
<?=$Num_Pages;?>
Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?sear=$id_title&Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?sear=$id_title&Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?sear=$id_title&Page=$Next_Page'>Next>></a> ";
}
mysql_close();
?>
ภาพประกอบครับ

Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-12-07 13:43:26 |
By :
teekaiman |
View :
778 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองตรวจสอบ link ที่ได้ออกมาดูครับว่าเป็นยังไง ถูกตามรูปแบบที่มันควรจะเป็นหรือเปล่า
|
 |
 |
 |
 |
Date :
2009-12-09 08:40:39 |
By :
Rutz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|