 |
จากโค้ดแบ่งหน้าของพี่ PlaKriM อยากเพิ่มค้นหาด้วยแต่ error ครับ |
|
 |
|
|
 |
 |
|
ไล่ดูครับ ผิดที่ sql
|
 |
 |
 |
 |
Date :
2010-11-09 10:58:27 |
By :
pjgunner.com |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เป็นเวลาคลิกเลขหน้าใช่ไหมครับ
Code (PHP)
if(isset($_GET["find"]) and !empty($_GET["find"])){
$send .= "&find=" . $_GET["find"];
$sql .= " and CompanyName_EN like '%" . $_GET["find"] . "%';";
}
|
 |
 |
 |
 |
Date :
2010-11-09 11:38:02 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$page = (isset($_GET['page']))? intval($_GET['page']) : 1;
$limit_end = 10;
$limit_start = ($page-1)*$limit_end;
$send = "";
$sql = "SELECT * FROM customer WHERE 1=1";
if(isset($_GET["find"]) and !empty($_GET["find"])){
$send = "find=" . $_GET["find"];
$sql .= " and CompanyName_EN like '%" . $_GET["find"] . "%';";
}
echo "<form id=\"form1\" name=\"form1\" method=\"get\" action=\"\">";
echo "Customer Name:<input type=\"text\" name=\"find\" id=\"find\" value=\"" . $_GET["find"] . "\" /> ";
echo "<input type=\"submit\" name=\"button\" id=\"button\" value=\"Search\" class=\"submit\"/>";
echo "</form>";
$query_id = mysql_query($sql . " LIMIT " . $limit_start. "," . $limit_end);
$count = mysql_num_rows($query_id);
$total = mysql_num_rows(mysql_query($sql));
$no =1;
if($total > 0){
echo "\n<div style=\"float:left;\">Page : " . page_navi($page, $limit_end, 4, $total, $send) . " </div><div style=\"float:right;\">[" . ($limit_start+1) . "-" . ($limit_start+$count) . "] of <strong>" . $total . "</strong></div><br>";
}
while($rows = mysql_fetch_array($query_id)){
echo "<table border=\"1\"><tr><td width=\"20\">";
echo $no;
echo "</td><td width=\"100\">";
echo $rows["CustCode"];
echo "</td><td width=\"300\">";
echo $rows["CompanyName_EN"]."<br>";
$no++;
echo "</td></tr></table>";
}
id เอามาจากไหน ผมเอาออกนะ
|
 |
 |
 |
 |
Date :
2010-11-09 13:28:41 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอบความคิดเห็นที่ : 4 เขียนโดย : PlaKriM เมื่อวันที่ 2010-11-09 13:28:41
ผมลองเอาโค้ดที่พี่เขียนให้ล่าสุดไปรันดู มัน error เหมือนเดิมครับพี่
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\satisfy\admin\mod_customer\test-page2.php on line 17
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\satisfy\admin\mod_customer\test-page2.php on line 18
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\satisfy\admin\mod_customer\test-page2.php on line 24
|
ประวัติการแก้ไข 2010-11-09 13:48:32
 |
 |
 |
 |
Date :
2010-11-09 13:46:40 |
By :
maruk |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปุ่มสวยอะ ชอบ..
|
 |
 |
 |
 |
Date :
2010-11-09 15:28:34 |
By :
unzeen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
error ว่าอะไร ตรงบรรทัดไหนครับ
|
 |
 |
 |
 |
Date :
2010-11-09 18:59:30 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
remote ไปช่วยแก้ดีกว่า
|
 |
 |
 |
 |
Date :
2010-11-10 09:40:59 |
By :
.. |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$query_id = mysql_query($sql . " LIMIT " . $limit_start. "," . $limit_end) or die(mysql_error() . "<br />" . $sql);
|
 |
 |
 |
 |
Date :
2010-11-10 12:02:50 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|