Jump to content

Ty44ler

Members
  • Posts

    133
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Ty44ler's Achievements

Member

Member (2/5)

0

Reputation

  1. Background: I work on an application that tracks server information. The data comes from 10 tables in a database that are exact replicas of 10 CSV files that insert daily into their specific tables. The database is nowhere near normalized and is a straight dump from the CSV to the db tables. (CSV headers match the table fields) Problem: I need to figure out a way to get the data from the CSV data into a normalized database for the application to read instead of a straight dump of the CSV data to the table. I have little control over the CSV's, but do have control over what happens with them afterwards. What would be the best way to get logical data into a normalized database from a set of CSV's? Thanks!
  2. Solved: foreach ($tasks as $task) { $task_list[$task['sr_id']]['task_id'][$task['sr_fe_task_id']] = array(); $task_list[$task['sr_id']]['task_id'][$task['sr_fe_task_id']]['due_date'] = $task['due_date']; $task_list[$task['sr_id']]['task_id'][$task['sr_fe_task_id']]['description'] = $task['description']; }
  3. I have a 1 dimensional array from a database output that I need to have in a multidimensional array ($tasks): array 0 => array 'sr_id' => string '4902367' (length=7) 'description' => string 'GLS Jersey Mikes Installation Checklist' (length=39) 'due_date' => string '2012-01-07 23:24:00' (length=19) 'sr_fe_task_id' => string '220958' (length=6) 1 => array 'sr_id' => string '4902367' (length=7) 'description' => string 'Please submit your pictures of the installation area before any work was performed.' (length=83) 'due_date' => string '2012-01-07 23:24:00' (length=19) 'sr_fe_task_id' => string '220959' (length=6) 2 => array 'sr_id' => string '4902367' (length=7) 'description' => string 'Please submit your pictures of the installation area after all work was completed.' (length=82) 'due_date' => string '2012-01-07 23:24:00' (length=19) 'sr_fe_task_id' => string '220960' (length=6) 3 => array 'sr_id' => string '4903303' (length=7) 'description' => string 'Upload pictures of colored patch cables connected to back of router.' (length=116) 'due_date' => string '2012-01-07 23:31:00' (length=19) 'sr_fe_task_id' => string '220961' (length=6) 4 => array 'sr_id' => string '4899664' (length=7) 'description' => string 'Please upload all pictures taken on site.' (length=41) 'due_date' => string '2012-01-17 17:33:00' (length=19) 'sr_fe_task_id' => string '222839' (length=6) Each sr_id may have more than one task under it and each task has a due_date and description under it, but I'm having trouble getting the descriptions and due_dates under each task: ['sr_id'] =>4902367 ['sr_fe_task_id'] => 220958 ['description']=> "GLS Jersey Mikes Installation Checklist" ['due_date']=> '2011-12-08 17:50:00' ['sr_fe_task_id'] => 220959 ['description']=> "Pleease submit your pictures of the installation area." ['due_date']=> '2012-01-07 23:24:00' ['sr_id'] =>4903303 ['sr_fe_task_id'] => 220961 ['description']=> "Upload pictures of colored patch cables connected to back of router." ['due_date']=> '2012-01-07 23:31:00' I've got it to where each sr_id is listed along with all the tasks underneath of them, but can't get it to where each task has the description and due date under it: for ($i=0; $i<COUNT($tasks); $i++){ $task_list[$tasks[$i]['sr_id']]['task_id'][$tasks[$i]['sr_fe_task_id']] =$tasks[$i]['sr_fe_task_id']; foreach ($task_list[$tasks[$i]['sr_id']]['task_id'] as $v){ $task_list[$tasks[$i]['sr_id']]['task_id'][$v][$tasks[$i]['due_date']]; } }
×
×
  • 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.