Jump to content

rjt90

Members
  • Posts

    4
  • Joined

  • Last visited

rjt90's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $array = array(0,0,0,0,0,1,2,3) Is it possible to use array_search() to find the key of the first non-zero element? Thanks.
  2. Var_hook is already formatted correctly (imploded). So the SQL correctly creates the number of arrays. My problem is that I can't make the arrays contain data? E.g. when I print the first series, it does not contain the data content for that series?
  3. $fetch_data = mysql_query("SELECT * FROM data WHERE data_id IN ($var_hook) ORDER BY time_id ASC"); $series = array(); foreach ($var_hook as $id) { $series[$id] = array(); } while ($new_row = mysql_fetch_array($fetch_data)) { $series[$new_row["data"]][] = $new_row; } print_r($series[1]); Hey - haven't coded for a while. Essentially I am trying to obtain info in the database where "data_id" matches one of the entries in $var_hook. For all matches (e.g. there may be two series that match) i want to create corresponding arrays that contain the data entries ("data") for each series. Above I have created the series arrays, but when I try and attach the rows (data entries) to the series, it doesn't seem to register within the respective series arrays? Would appreciate help! I expect it is an elementary error - but can't see it yet!
×
×
  • 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.