|
 |
|
Code แบ่งหน้า จะเพิ่ม Listbox ขึ้นมาเพื่อให้สามารถเลือกได้ว่าจะแสดงเป็นจำนวนที่เราเลือก ต้องทำยังไงคะ |
|
 |
|
|
 |
 |
|
Code (PHP)
<select name="selmenu">
<?
for($i=1;$i<=50;$i++)
{
if($_GET["Line"] == $i)
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$_SERVER["PHP_SELF"];?>?Page=<?=$i;?>" <?=$sel;?>><?=$i;?></option>
<?
}
?>
</select>
ประมาณนี้ครับ
|
 |
 |
 |
 |
Date :
2011-03-11 13:02:06 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองทำแล้วไม่ได้เลยค่ะ ต้องเปลี่ยนตัวแปลในโค๊ตป๊าวคะ
|
 |
 |
 |
 |
Date :
2011-03-23 11:47:05 |
By :
mostgirls |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
             
|
 |
 |
 |
 |
Date :
2011-03-30 13:48:03 |
By :
mostgirls |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
/*** By Weerachai Nukitram ***/
/*** http://www.ThaiCreate.Com ***/
?>
<html>
<head>
<title>Linkgraphix-catalog</title>
<style type="text/css">
<!--
.style4 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF; font-weight: bold; }
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
font-weight: bold;
}
a:visited {
color: #3399FF;
}
a:hover {
color: #FF3300;
}
a:active {
color: #0099FF;
}
.style6 {
font-size: 12px;
color: #009900;
}
a:link {
color: #009900;
}
.style8 {color: #009900}
.style9 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #009900; font-weight: bold; }
.style10 {font-weight: bold; font-family: Arial, Helvetica, sans-serif;}
-->
</style>
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script>
!window.jQuery && document.write('<script src="jquery-1.4.3.min.js"><\/script>');
</script>
<script type="text/javascript" src="./fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.2.js"> </script>
<link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.2.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
/*
* Examples - images
*/
$("a[rel=example_group]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
/*
* Examples - various
*/
});
</script>
<script>
function showStates() {
if (document.getElementById('country')) {
var selectedCountry=document.getElementById('country').options[document.getElementById('country').selectedIndex].value;
if (selectedCountry=='Testland'||selectedCountry=='Thai') {
document.getElementById('states').style.display='block';
} else {
document.getElementById('states').style.display='none';
}
if (selectedCountry=='United States'||selectedCountry=='USA') {
document.getElementById('states').style.display='block';
} else {
document.getElementById('states').style.display='none';
}
}
};
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="../images/favicon.ico">
<link rel="icon" type="image/gif" href="../images/animated_favicon1.gif" >
</head>
<body>
<div align="center">
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("link_db");
$strSQL = "SELECT * FROM stock_lj where id = id AND type='linkgraphix' ORDER BY product_id desc ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
?><select name='' onChange='this.form.submit()'>
<option value='12' >12</option>
<option value='24' >24</option>
<option value='36' selected>36</option>
<option value='48' >48</option>
<option value='60' >60</option>
</select><?
$Per_Page = 12; //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;
}
//$strSQL .=" order by catid ASC LIMIT $Page_Start , $Per_Page";
$strSQL .=" LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
echo "<td>";
?>
<table width="150" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td align="center"><table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center">
<a rel="example_group" href="../picture/jumbo/<?=$objResult["pic2"];?>"><img style="border:none" src="../picture/jumbo/<?=$objResult["pic"];?>" /></a></div></td>
</tr>
</table></td>
</tr>
</table>
<?
echo"</td>";
if(($intRows)%6==0)
{
echo"</tr>";
}
else
{
echo "<td>";
}
}
echo"</tr></table>";
?>
<br>
<span class="style6"><a href="../thai/collection.php">กลับหน้า Collection</a>
<span class="style10">Total
<?= $Num_Rows;?>
Records :
<?=$Num_Pages;?>
Pages :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
mysql_close($objConnect);
?>
</span></span></div>
</body>
</html>
|
ประวัติการแก้ไข 2011-03-31 10:16:01
 |
 |
 |
 |
Date :
2011-03-30 14:00:55 |
By :
mostgirls |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|