Cheers for the info nogdog.
Does anything look out of the ordinary with how i have written this then? I just need to rule out me being a complete idiot within my code. But 8 connections for each page seems excessive. It does seem to be similar to the bug you linked to.
class products (extract)
class products
{
private $database;
private $paging;
//create a singleton instance
private static $instance = NULL;
private function __construct()
{
$this->database = database::getinstance();
$this->paging = paging::getinstance();
}
public function getinstance()
{
if(self::$instance === null)
{
$c = __CLASS__;
self::$instance = new $c;
}
return self::$instance;
}
//prevent clone
public function __clone()
{
throw new Exception("Cannot clone ".__CLASS__." class");
}
public function getallproducts($order='name')
{
$order = $this->database->antisql($order);
if ($results = $this->paging->query("SELECT categories.name, categories.url, products.id, products.product_code, products.style_name, products.category_id, products.colour_code, products.colour_description, products.size_code, products.style_code, products.collection_code, products.product_group, products.net_weight, products.rrp, products.offer_price, products.stock, products.points, products.video, products.description, products.live FROM `products` INNER JOIN categories ON products.category_id=categories.id ORDER BY $order ASC"))
{
return $results;
}
return 0;
}
}
?>
product range
$products = products::getinstance();
$product = $products->getallproducts();
while ($row = $product->fetch_array(MYSQLI_ASSOC))
{
$image = $products->getprodimage($row['id']);
?>
<li class="product">
<a href="<?=$products->producturlbuilder($row['id'])?>"><img src="<?=$image['front']['range']?>" alt="<?=$row['style_name']?>"/></a><br />
<h2><?=$row['style_name']?></h2>
<span class="price">£<?=money_format('%i', $row['rrp'])?></span>
<span class="details"><a href="<?=$products->producturlbuilder($row['id'])?>">view details</a></span>
</li>
<?php
}