Loading ...
Sorry, an error occurred while loading the content.

Re: need array help

Expand Messages
  • Mitchelle C. Pascual
    this should be like this: $arr = array(); $x = 0; while ($row = mysql_fetch_assoc($query)) { $arr[$x] = $row; $x++; } print_r($arr); hope this helps! ;)
    Message 1 of 2 , Jan 28, 2007
    • 0 Attachment
      this should be like this:

      $arr = array();
      $x = 0;
      while ($row = mysql_fetch_assoc($query)) {
      $arr[$x] = $row;
      $x++;
      }

      print_r($arr);

      hope this helps! ;)
      --- In phpexperts@yahoogroups.com, "Razib Ahmed" <rrrajib1@...> wrote:
      >
      > hi, all my friends. i need help for this problem. my porblem is:
      >
      > i have a catagory id as $catID and item id as $itemID.
      >
      > when i echo this $catID it's show like this: 2,10,6
      >
      > and when i echo $itemID it's show like this : 25,70,30
      >
      > now i want to insert value into array()with php.
      >
      > like this:
      >
      > $arr = array(
      > 1 => array('cat' => '2', 'itm' => 25),
      > 2 => array('cat' => '10', 'itm' => 70),
      > 3 => array('cat' => '6', 'itm' => 30),
      > );
      >
      > and then i want to sort this array by $catID;
      > please help me. as early as possible.
      >
      > Razib Ahmed
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.