01.
<?
02.
session_start();
03.
include
"inc/config.inc.php"
;
04.
?>
05.
<?php
06.
if
(!function_exists(
"GetSQLValueString"
)) {
07.
function
GetSQLValueString(
$theValue
,
$theType
,
$theDefinedValue
=
""
,
$theNotDefinedValue
=
""
)
08.
{
09.
if
(PHP_VERSION < 6) {
10.
$theValue
= get_magic_quotes_gpc() ?
stripslashes
(
$theValue
) :
$theValue
;
11.
}
12.
13.
$theValue
= function_exists(
"mysql_real_escape_string"
) ? mysql_real_escape_string(
$theValue
) : mysql_escape_string(
$theValue
);
14.
15.
switch
(
$theType
) {
16.
case
"text"
:
17.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
18.
break
;
19.
case
"long"
:
20.
case
"int"
:
21.
$theValue
= (
$theValue
!=
""
) ?
intval
(
$theValue
) :
"NULL"
;
22.
break
;
23.
case
"double"
:
24.
$theValue
= (
$theValue
!=
""
) ? doubleval(
$theValue
) :
"NULL"
;
25.
break
;
26.
case
"date"
:
27.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
28.
break
;
29.
case
"defined"
:
30.
$theValue
= (
$theValue
!=
""
) ?
$theDefinedValue
:
$theNotDefinedValue
;
31.
break
;
32.
}
33.
return
$theValue
;
34.
}
35.
}
36.
37.
function
unitToTxt(
$id
){
38.
switch
(
$id
):
39.
case
1:
return
"วัน"
;
break
;
40.
case
2:
return
"เดือน"
;
break
;
41.
case
3:
return
"ปี"
;
break
;
42.
endswitch
;
43.
}
44.
mysql_select_db(
$mysql_select_db
,
$mysql_connect
);
45.
$query_price
=
"SELECT setting_point.price, setting_point.`number`, setting_point.unit FROM setting_point"
;
46.
$price
= mysql_query(
$query_price
,
$mysql_connect
)
or
die
(mysql_error());
47.
$row_price
= mysql_fetch_assoc(
$price
);
48.
$totalRows_price
= mysql_num_rows(
$price
);
49.
?>
50.
<style type=
"text/css"
>
51.
.center {
52.
text-align: center;
53.
}
54.
</style>
55.
<body>
56.
<table width=
"356"
border=
"1"
>
57.
<tr>
58.
<th width=
"111"
scope=
"col"
>ราคา</th>
59.
<th width=
"226"
scope=
"col"
>เวลาใช้งาน</th>
60.
</tr>
61.
</table>
62.
<?php
do
{ ?>
63.
<table width=
"356"
border=
"1"
>
64.
<tr
class
=
"center"
>
65.
<th width=
"111"
scope=
"col"
><?php
echo
$row_price
[
'price'
]; ?></th>
66.
<th width=
"111"
scope=
"col"
><?php
echo
$row_price
[
'number'
]; ?></th>
67.
<th width=
"112"
bgcolor=
"#FF66CC"
scope=
"col"
><?php
echo
unitToTxt(
$row_price
[
'unit'
]); ?></th>
68.
</tr>
69.
</table>
70.
<?php }
while
(
$row_price
= mysql_fetch_assoc(
$price
)); ?>
71.
</body>
72.
</html><?php
73.
mysql_free_result(
$price
);
74.
?>