php db open_datebase_connec tion DATEBASE LAST ADDED GOODS last_10good

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$db = open_datebase_connection('DATEBASE#1');
//LAST ADDED GOODS
$last_10goods=mysql_query("SELECT * FROM project_goods WHERE (`sellscount`='0' OR `sales`<`sellscount`) ORDER BY id DESC LIMIT 0,5",$db);
While($lg=mysql_fetch_array($last_10goods)) {
$pic=explode('|',$lg['pictures']);
$decoded_pic_path = decode_str($pic[0],True);
$LGLIST.='
<div id="tvr_ITEM">
<a href="/goods/'.$lg['cat'].'/'.$lg['id'].'">
<img id="tvr_image" src="'.$pic[0].'"/>
</a>
<div id="tvr_tile">'.mb_substr($lg['tile'],0,16,'UTF-8').'</div>
<div id="tvr_author"><a href="/users/'.$lg['owner'].'" target="_blank">'.$lg['owner_login'].'</a></div>
<div id="tvr_price">'.$lg['price'].' RUR</div>
</div>';
}
//MOST POPULAR GOODS
$GPOPULAR=mysql_query("SELECT * FROM project_goods WHERE (`sellscount`='0' OR `sales`<`sellscount`) ORDER BY sales DESC LIMIT 0,20",$db);
While($lg=mysql_fetch_array($GPOPULAR)) {
$pic=explode('|',$lg['pictures']);
$decoded_pic_path = decode_str($pic[0],True);
$POPULAR_GOODS.='
<div id="tvr_ITEM">
<a href="/goods/'.$lg['cat'].'/'.$lg['id'].'">
<img id="tvr_image" src="'.$pic[0].'"/>
</a>
<div id="tvr_tile">'.mb_substr($lg['tile'],0,16,'UTF-8').'</div>
<div id="tvr_author"><a href="/users/'.$lg['owner'].'" target="_blank">'.$lg['owner_login'].'</a></div>
<div id="tvr_price">'.$lg['price'].' RUR</div>
</div>';
}
$TEMPLATE_CONTEXT_PROCESSORS=Array(
'LAST10_ADDED_GOODS'=>$LGLIST,
'MOST_POPULAR_ADDED_GOODS'=>$POPULAR_GOODS,
);