Я новичок не судите строго! В общем всё было "ОК" пока не появилась данная ошибка. Сколько не искал не могу понять в чём проблема. В строке указанной в файле всё вроде ровно! while($row = mysql_fetch_array($result))
Я прекрасно понимаю что ответ от SQL приходит false, но вот почему пока не могу понять.
<?
function db_connect()
{
$host = 'host';
$user = 'user';
$pswd = 'pswd';
$db = 'db';
$connection = mysql_connect($host, $user, $pswd);
if(!$connection || !mysql_select_db($db, $connection))
{
return false;
}
return $connection;
}
function db_result_to_array()
{
$res_array = array();
$count = 0;
while($row = mysql_fetch_array($result))
{
$res_array[$count] = $row;
$count++;
}
return $res_array;
}
function get_products()
{
db_connect();
$query = "SELECT * FROM products ORDER BY id DESC";
$result = mysql_query($query);
$result = db_result_to_array($result);
return $result;
}
?>
а должно выводится вот тут:
<?
$products = get_products();
foreach($products as $item):
?>
<table align="center" cellpadding="0" cellspacing="0" class="product" border="0">
<tr>
<td valign="top">
<div><a href="#"><img src="userfiles/<?=$item['image']?>" alt="" /></a></div>
<div class="description">
<div class="product-name"><a href="#"><?=$item['title']?></a></div>
<div class="product-price">Цена: <?=$item['price']?> $</div>
</div>
</td>
</tr>
</table>
<?
endforeach;
?>