001.
<?php
002.
session_start();
003.
include
(
"con_connect.php"
);
004.
?>
005.
<?php
006.
007.
if
(isset(
$_SESSION
[
"ses_id"
]) && isset(
$_SESSION
[
"ses_user_r"
]) &&(
$_SESSION
[
"ses_status_1"
]!==1) ) {
008.
009.
}
else
{
010.
echo
"<center>You are not member</center><br>"
;
012.
exit
();
013.
}
014.
?>
015.
016.
<html>
017.
<head>
018.
<title>ThaiCreate.Com</title>
019.
</head>
020.
<body>
021.
<?php
022.
$strSQL
=
"SELECT * FROM customer "
;
023.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
024.
$Num_Rows
= mysql_num_rows(
$objQuery
);
025.
026.
$Per_Page
= 2;
027.
028.
$Page
=
$_GET
[
"Page"
];
029.
if
(!
$_GET
[
"Page"
])
030.
{
031.
$Page
=1;
032.
}
033.
034.
$Prev_Page
=
$Page
-1;
035.
$Next_Page
=
$Page
+1;
036.
037.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
038.
if
(
$Num_Rows
<=
$Per_Page
)
039.
{
040.
$Num_Pages
=1;
041.
}
042.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
043.
{
044.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
045.
}
046.
else
047.
{
048.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
049.
$Num_Pages
= (int)
$Num_Pages
;
050.
}
051.
052.
$strSQL
.=
" order by CustomerID ASC LIMIT $Page_Start , $Per_Page"
;
053.
$objQuery
= mysql_query(
$strSQL
);
054.
?>
055.
<table width=
"600"
border=
"1"
>
056.
<tr>
057.
<th width=
"91"
> <div align=
"center"
>CustomerID </div></th>
058.
<th width=
"98"
> <div align=
"center"
>Name </div></th>
059.
<th width=
"198"
> <div align=
"center"
>Email </div></th>
060.
<th width=
"97"
> <div align=
"center"
>CountryCode </div></th>
061.
<th width=
"59"
> <div align=
"center"
>Budget </div></th>
062.
<th width=
"71"
> <div align=
"center"
>Used </div></th>
063.
</tr>
064.
<?php
065.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
066.
{
067.
?>
068.
<tr>
069.
<td><div align=
"center"
><?php
echo
$objResult
[
"CustomerID"
];?></div></td>
070.
<td><?php
echo
$objResult
[
"Name"
];?></td>
071.
<td><?php
echo
$objResult
[
"Email"
];?></td>
072.
<td><div align=
"center"
><?php
echo
$objResult
[
"CountryCode"
];?></div></td>
073.
<td align=
"right"
><?php
echo
$objResult
[
"Budget"
];?></td>
074.
<td align=
"right"
><?php
echo
$objResult
[
"Used"
];?></td>
075.
</tr>
076.
<?php
077.
}
078.
?>
079.
</table>
080.
081.
<br>
082.
Total <?php
echo
$Num_Rows
;?> Record : <?php
echo
$Num_Pages
;?> Page :
083.
<?php
084.
if
(
$Prev_Page
)
085.
{
086.
echo
" <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "
;
087.
}
088.
089.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
090.
if
(
$i
!=
$Page
)
091.
{
092.
echo
"[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"
;
093.
}
094.
else
095.
{
096.
echo
"<b> $i </b>"
;
097.
}
098.
}
099.
if
(
$Page
!=
$Num_Pages
)
100.
{
101.
echo
" <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "
;
102.
}
103.
mysql_close(
$objConnect
);
104.
?>
105.
</body>
106.
</html>