01.
<?
02.
include
"function.php"
;
03.
include
"connect.php"
;
04.
for
(
$i
=1;
$i
<=
count
(
$newtype
);
$i
++) {
05.
echo
"<B>$newtype[$i]</B><BR>"
;
06.
07.
08.
$sql
=
"select * from tb_new where type_new='$i' "
;
09.
$result
=mysql_db_query(
$dbname
,
$sql
);
10.
$total
=mysql_num_rows(
$result
);
11.
if
(
$num
>0) {
12.
echo
"<TABLE BORDER=1 CELLPADDING=5 CELLSPACING=5 BORDERCOLOR='#CCCCCC'>"
;
13.
$check
=1;
14.
$sql
=
"select * from tb_new where type_new='$i' order by date_new desc limit 0,5"
;
15.
$result
=mysql_db_query(
$dbname
,
$sql
);
16.
while
(
$r
=mysql_fetch_array(
$result
)) {
17.
$id_new
=
$r
[id_new];
18.
$title_new
=
$r
[title_new];
19.
$type_new
=
$r
[type_new];
20.
$date_new
=displaydate(
$r
[date_new]);
21.
$price_new
=
$r
[price_new];
22.
$photo_new
=
$r
[photo_new];
23.
24.
if
(
$check
%5 ==1) {
25.
echo
"<TR>"
;
26.
}
27.
echo
" <TD WIDTH=100 VALIGN=
'middle'
BORDERCOLOR=
'#FFFFFF'
>
28.
<CENTER><A HREF=
'/view.php?id_view=$id_new'
TARGET=
'_blank'
><IMG SRC=
'/photo_small/$photo_new'
></A><BR>
29.
<P><B> รุ่น:</B>
$title_new
<BR> <B>ราคา:</B>
$price_new
</P></CENTER>
30.
</TD>";
31.
if
(
$check
% 5 == 0) {
32.
echo
"</TR>"
;
33.
$check
=0;
34.
}
35.
$check
++;
36.
}
37.
$check
++;
38.
}
39.
echo
"</TABLE>"
;
40.
}
41.
if
(
$total
>=5) {
42.
echo
"<LI> <A HREF='list.php?id_type=$i'>ดูสิ้นค้ายี่ห้อนี้ทั้งหมด...</A> </LI>"
;
43.
}
44.
45.
?>