<?php
function db_connect()
{
$host = 'localhost';
$user = 'root';
$password = '';
$db = 'elite_shop';
$connection = mysql_connect($host, $user, $password);
if (!conection || !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 title FROM products";
$result = mysql_query($query);
$result = db_result_to_array($result);
return $result;
}
?>
<?
$products = get_products();
foreach($products as $item) :?>
<table align="center" cellpadding="0" class="product" border="0">
<tr>
<td valign="top">
<div><a href="#"<img src="img/<? $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;?>
Вроде все верно, но выдает ошибку
Warning: mysql_fetch_array() expects parameter 1 to be resource, integer given in Z:\home\mysite.ru\www\db_fns.php on line 28
Помогите разобраться.