Jump to content

jntcomputers

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jntcomputers's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=368662:date=Apr 25 2006, 06:14 PM:name=Ferenc)--][div class=\'quotetop\']QUOTE(Ferenc @ Apr 25 2006, 06:14 PM) [snapback]368662[/snapback][/div][div class=\'quotemain\'][!--quotec--] $_SESSION['post_value'][$key] = $value; [/quote] Does this mean I have to enter the field value for every field. I.E. [code] $_SESSION['name'][$key] = $value; $_SESSION['email'][$key] = $value; [/code] And so on? Because there are liike 80 fields. Is there a way to do it dynamically?
  2. I have a four page form and want to store the data in a session until it is submitted. I have this code at the top: [code] session_start(); $_SESSION['id'] = uniqid(); if (isset($_POST[$key])) {         $_SESSION[$key] = $_POST[$key];         echo "TESTING SESION SET!<br>"; } print_r ($_SESSION); print_r ($_POST); [/code] But this out puts: Array( [id] => 444e9b5b2d41c [] => ) Array ( [B_FirstName] => test [B_MiddleInitial] => [B_LastName] => [B_SSAN] => [B_DateOfBirth] => [B_Email] => [B_HomePhone] => [B_CellPhone] => [B_WorkPhone] => [B_MaritalStatus] => ---- [B_YearsSchool] => [B_NumDependents] => [B_DependentAges] => [B_HomeAddress1] => [B_HomeAddress2] => [B_HomeCity] => [B_HomeState] => [B_HomeZip] => [B_YearsAtAddress1] => [B_MailingAddress1] => [B_MailingAddress2] => [B_MailingCity] => [B_MailingState] => [B_MailingZip] => [B_PrevAddress1] => [B_PrevAddress2] => [B_PrevCity] => [B_PrevState] => [B_PrevZip] => [B_YearsAtAddress2] => [coborrower] => Next Page --> ) As you can see the session variables from the form are blank, but the post variables are not. What am I doing wrong?!?
  3. [code]$sql2 = "SELECT start_time, end_time FROM default_ScheduleEvents  WHERE (default_ScheduleEvents.aircraft_id = $this_aircraft_id)"; $recordSet2 = $conn->Execute($sql2); if ($recordSet2 === false) { log_error($sql2); } $num_records = $recordSet2->RecordCount(); if ($num_records > 0) { $hours_array = array(); while (!$recordSet2->EOF) { $st_time = strtotime(make_db_unsafe ($recordSet2->fields[start_time]));//start time in unix stamp $en_time = strtotime(make_db_unsafe ($recordSet2->fields[end_time]));//end time in Unix stamp             $this_date = DATE("M-d-Y",$st_time); $flight = ($en_time - $st_time)/3600; //Flight time in hours $day_of_week = date("l", $st_time); if(isset($hours_array[$time_slot])){ //...add the current hour value to the //existing value.. $hours_array[$day_of_week] += $flight; } else { //if the name isn't there, then add it and //give it the value of the hours $hours_array[$day_of_week] = $flight; } echo "<tr><td>$day_of_week</td><td>Time of day</td><td>$hours_array[$day_of_week]</td></tr>"; $recordSet2 ->MoveNext(); } // end if number > 0[/code] This is what I have so far. This outputs the total hours scheduled for the day of the week. What I need is a way to take the hours a subdivide them into time of day (i.e. morning, afternoon, evening). The code I have may be no good to do this. The thing to remember is that a reservation might be made between two times, for example a reservation made from 8am to 2pm would be 4 hours in "Morning" and 2 hours in "Afternoon".
  4. I am working on a query of scheduled times and want to be able to display the results like this: Saturday Afternoon: 35 hours Sunday Morning: 32.5 Hours Sunday Afternoon: 29 Hours Saturday Evening: 21 Hours (Morning: 6 a - 12p/Afternnon: 12:01p - 4p/Evening:4:01p - 8p) And so on. I have gotten the query to pull the hours, I can post the query if needed. Any ideas?
  5. I am trying to tak emultiple entries and add values from the same user into one value. I have this code: [code] $sql_select = "SELECT user_id, start_time, end_time FROM default_ScheduleEvents WHERE (school_id = $this_school)";     $recordSet_select = $conn->Execute($sql_select);     if ($recordSet_select === false)         {         //log_error($sql); mysql_error();         }     $num_records = $recordSet_select->RecordCount();     if ($num_records > 0) {     $hours_array = array();     while (!$recordSet_select->EOF)         {         $this_pilot_id = make_db_unsafe ($recordSet_select->fields[user_id]);         $st_time = strtotime(make_db_unsafe ($recordSet_select->fields[start_time]));         $en_time = strtotime(make_db_unsafe ($recordSet_select->fields[end_time]));         $this_date = DATE("M-d-Y",$st_time);         $flight = ($en_time - $st_time)/3600;         //$flight_time = DATE("g:i",strtotime($flight));                  $sql2 = "SELECT field_name, field_value FROM default_UserDBElements WHERE (user_id = $this_pilot_id)";         $recordSet2 = $conn->Execute($sql2);             if ($recordSet2 === false)         {         //log_error($sql); mysql_error();         }         while (!$recordSet2->EOF)         {         if ($recordSet2->fields[field_name] == "name"){ $pilot_name = $recordSet2->fields[field_value]; };         $recordSet2->MoveNext();         } // end while              if ($pilot_name != "") {     if(isset($hours_array[$pilot_name])){         //...add the current hour value to the         //existing value..         $hours_array[$pilot_name] += $flight;     } else {         //if the name isn't there, then add it and         //give it the value of the hours         $hours_array[$pilot_name] = $flight;              }             echo "<tr><td class=\"dispatch_flight\">$this_date</td><td class=\"dispatch_flight\">$pilot_name</td><td class=\"dispatch_flight\">$hours_array[$pilot_name]</td></tr>"; } // end if pilot != ""     $recordSet_select->MoveNext();     } // end while     } // end if number > 0 echo "</tr></table>"; ?> [/code] But it outputs User Name : Hours USER 1 : 1.5 USER 1 : 7.5 When the table values are 1.5 & 6. So it is adding them, but I can't figure out how to show the user name only once.
×
×
  • 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.