In my code, 'product'
table is returning every product details in the table.
Now I want to get specific product details of 0 to 5th product. How can I change this while loop to a for loop?
Code:
public function getProducts(){
$query = "SELECT * FROM shop_product";
$resultSet = Array();
$result = mysql_query($query) or die (mysql_error());
while($fetchResult = mysql_fetch_array($result,MYSQL_ASSOC)){
$resultSet[] = $fetchResult;
}
mysql_free_result($result);
return $resultSet;
}
SELECT * FROM shop_product LIMIT 0,5
– Mike W May 2 at 4:03