Jump to content

bulmer

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by bulmer

  1. Thanks MMDE and gizmola, that did the trick with a lot less code than I imagined.. So if I understand correctly it uses the first field as the key in the main array, creates a new empty array under it and numerically appends all 'plant' fields to it that have that same key? By the way i've always found this site to be a great help and resource, keep up the good work.Cheers.
  2. I have been trying to solve this problem for a few days now and can't seem to work it out. I'm sure i'm missing some simple point.. I am using a mysql PDO fetch to return 2 fields in each row and then put them into an array of their own: foreach ($st->fetchAll() as $row){ $subs[] = array($row['subscriber'],$row['plant']); Some of the rows share the same $row[0], which is the 'subscriber' field. What I want to do is make up another array with each smaller array having a single, unique $row[0] and any number of added 'plant' fields following (e.g $row[1],$row[2] etc). I've tried all sorts of ways to achieve this but am at a loss. Would someone be able to point me in the right direction ? Thanks.
×
×
  • 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.