include 'vars.php';
include 'head.php';
$link = mysql_connect($host_name, $user_name, $pass_word) or die("Could not connect : " . mysql_error());
mysql_select_db($base_name) or die("Could not select database");
$result=mysql_query('set names "utf8";');
$query="SELECT * FROM item ORDER BY id;";
$result=mysql_query($query);
if ($result) {
?>
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
?>
switch($row[5]) {
case 0: $cur='руб.';
break;
case 1: $cur='$';
break;
case 2: $cur='€';
break;
}
printf (" %s | Название: %s |
Номер по каталогу: %s |
Цена: %.2f %s |
Описание: %s |
", $row[0], $row[0], $row[0], $row[1], $row[3], $row[4], $cur, strip_tags(html_entity_decode($row[2])));
$photo_q="SELECT pict FROM photos WHERE itemid=";
$photo_q.=$row[0];
$photo_q.=" ORDER BY id;";
$photo_r=mysql_query($photo_q);
?>
$im_count=0;
while($photo_row=mysql_fetch_array($photo_r, MYSQL_NUM)) {
$th_name='uploads/thumb_'.substr($photo_row[0],0,strrpos($photo_row[0], ".")).'.jpg';
list($width, $height) = getimagesize($th_name);
$im_count++;
?>
|
if($im_count==10) {
echo " ";
$im_count=0;
};
};
?>
|
mysql_free_result($photo_r);
?>
|
}
mysql_free_result($result);
?>
};
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
};
include 'bottom.php';
?>