001.
<TABLE width=
"900"
height=
"0"
border=
"1"
align=
"left"
>
002.
<TR bgcolor=
"#C0C0C0"
><TD ><CENTER><font face=
"Angsana News"
size=6 color=
"Black"
><B>¢éÍÁÙÅÊÔ¹¤éÒ</B></CENTER>
003.
<A Href =
"DataProduct.php"
><IMG SRC=
"addProduct.jpg"
width=
"220"
height=
"60"
border=
"0"
align=
"left"
></A>
004.
</TD></TR>
005.
<TR >
006.
<center>
007.
<?
008.
include
(
"connect.php"
);
009.
mysql_query (
"SET NAMES utf8"
)
or
die
(mysql_errno());
010.
$result
= mysql_query(
$sql
);
011.
$strSQL
=
"SELECT * FROM product "
;
012.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
013.
$Num_Rows
= mysql_num_rows(
$objQuery
);
014.
$Per_Page
= 10;
015.
$Page
=
$_GET
[
"Page"
];
016.
if
(!
$_GET
[
"Page"
])
017.
{
018.
$Page
=1;
019.
}
020.
$Prev_Page
=
$Page
-1;
021.
$Next_Page
=
$Page
+1;
022.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
023.
if
(
$Num_Rows
<=
$Per_Page
)
024.
{
025.
$Num_Pages
=1;
026.
}
027.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
028.
{
029.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
030.
}
031.
else
032.
{
033.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
034.
$Num_Pages
= (int)
$Num_Pages
;
035.
}
036.
$strSQL
.=
" order by ID_Pro DESC LIMIT $Page_Start , $Per_Page"
;
037.
$objQuery
= mysql_query(
$strSQL
);
038.
?>
039.
</center>
040.
<TD>
041.
<?
042.
include
(
"connect.php"
);
043.
$sqlProcuct
=
"select *from product"
;
044.
$dbqueryProcuct
= mysql_query(
$sqlProcuct
);
045.
?>
046.
047.
<table width=
"900"
border=
"1"
>
048.
<tr >
049.
<td width=
"45"
> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>ลำดับที่</B></div></td>
050.
<td> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>รหัสสินค้า</B></div></td>
051.
<td width=
"300"
> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>ชื่อสินค้า</B></div></td>
052.
<td> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>ราคา</div></td>
053.
<td> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>หน่วยนับ</div></td>
054.
<td> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>สินค้าคงเหลือ</B></div></td>
055.
<td> <div align=
"center"
><font face=
"Angsana News"
size=5 color=black ><B>รายละเอียด</B> </div></td>
056.
</tr>
057.
<?
058.
$i
=1;
059.
while
(
$rs
= mysql_fetch_array(
$dbqueryProcuct
)){
060.
echo
"<tr><td align=center>"
;
061.
echo
$i
;
062.
$i
=
$i
+1;
063.
echo
"</td><td align=center>"
;
064.
echo
$rs
[
'ID_Pro'
];
065.
echo
"</td><td align=left>"
;
066.
echo
$rs
[
'Name_Pro'
];
067.
echo
"</td><td align=right>"
;
068.
echo
$rs
[
'Price_Pro'
];
069.
echo
"</td><td align=center>"
;
070.
echo
$rs
[
'Unit_Pro'
];
071.
echo
"</td><td align=right>"
;
072.
echo
$rs
[
'Inventories_Pro'
];
073.
echo
"</td><td align=center>"
;
074.
075.
echo
"<a href = 'ShowDetialDataProduct.php?ID_Pro="
.
$rs
['ID_Pro
']."'
><IMG SRC=
'click.gif'
width=
'40'
height=
'40'
border=
'0'
align=
'center'
></a> ";
076.
077.
078.
echo
"</td></tr>"
;
079.
}
080.
?>
081.
<BR>
082.
 <font face=
"Angsana News"
size=5 color=black>จากข้อมูลทั้งหมด<?=
$Num_Rows
;?รายการ    มี<?=
$Num_Pages
;?>หน้า  หน้าที่ :</font>
083.
<?
084.
if
(
$Prev_Page
)
085.
{
086.
echo
" <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ย้อนกลับ</a> "
;
087.
}
088.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
089.
if
(
$i
!=
$Page
)
090.
{
091.
echo
"[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"
;
092.
}
093.
else
094.
{
095.
echo
"<b> $i </b>"
;
096.
}
097.
}
098.
if
(
$Page
!=
$Num_Pages
)
099.
{
100.
echo
" <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>ถัดไป>></a> <BR><BR>"
;
101.
}
102.
mysql_close();
103.
?>
104.
</TABLE>
105.
</TD>
106.
</TR>
107.
</TABLE>