Jump to content

array_slice()


dhimok

Recommended Posts

How can I paginate this query using array_chunk() and array_slice()

 

 


<?php
function get_products($id) {
  global $products;

  $result = mysql_query("SELECT * FROM products WHERE category_id = '{$id}' ORDER BY price ASC ");

  while($row = mysql_fetch_object($result)) {
    $products[] = $row->product_id;

  }

  //get children
    $result = mysql_query("SELECT category_id FROM categories WHERE parent_id = {$id}");
    while ($row = mysql_fetch_assoc($result)) {
      get_products($row["category_id"]);

  } 
}

?>

 

Some ahead start would be a great help

Link to comment
https://forums.phpfreaks.com/topic/67935-array_slice/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.