
// реализация поиска
$result = mysql_query ("SELECT id_d, id_re, city, street,
num_h, floor_h, floor, id_bal,
id_to, id_h, id_ser, id_dec, id_est,
date, price, memo, num_ag, reg_vl,
type_b, type_t, type_h, type_s, type_e,
type_o, id_oper, type_d, id_dec
FROM t_estate, demand, t_decor,
t_house, t_oper, agency, region,
t_balcony, t_tobath, t_series
WHERE region.id = demand.id_re
AND t_estate.id = demand.id_est
AND t_decor.id = demand.id_dec
AND t_house.id = demand.id_h
AND t_oper.id = demand.id_oper
AND t_balcony.id = demand.id_bal
AND t_tobath.id = demand.id_to
AND t_series.id = demand.id_ser
if ($reg_vl != 0) {$result .= 'AND id_re ='.$reg_vl. ' ';}
if ($street != 0) {$result .= 'AND street ='.$street. ' ';}
if ($type_e != 0) {$result .= 'AND id_est ='.$type_e. ' ';}
if ($floor != 0) {$result .= 'AND floor ='.$floor. ' ';}
if ($type_b != 0) {$result .= 'AND id_bal ='.$type_b. ' ';}
if ($type_t != 0) {$result .= 'AND id_to ='.$type_t. ' ';}
if ($type_h != 0) {$result .= 'AND id_h ='.$type_h. ' ';}
if ($type_s != 0) {$result .= 'AND id_ser ='.$type_s. ' ';}
if ($type_d != 0) {$result .= 'AND id_dec ='.$type_d. ' ';}
if ($type_o != 0) {$result .= 'AND id_oper ='.$type_o. ' ';}
", $db);
if (!$result)
{
echo "Запрос на выборку данных из базы не прошел. Напишите об этом администратору paradigma2007@rambler.ru.
<strong>Код ошибки:</strong>";
exit (mysql_error ());
}
if (mysql_num_rows($result) > 0)
{
$myrow = mysql_fetch_array ($result);
do
{
printf ("
<table width='610' align='center'>
<tr>
<td width='100'><p class = 'main7'>%s</p></td>
<td width='160'><p class = 'main7'>%s</p></td>
<td width='150'><p class = 'main7'>%s</p></td>
<td width='100'><p class = 'main7'>%s</p></td>
<td width='100' valign='top'><p ><div id='coolmenu'><a href = 'view_pod.php?pod=%s'>подробнее</a></div></p></td>
</tr>
</table>
",$myrow["date"],$myrow["city"],$myrow["type_e"],$myrow["price"], $myrow["id_d"]);
}
while ($myrow = mysql_fetch_array ($result));
}
?>