Jump to content

clay1

Members
  • Posts

    161
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

clay1's Achievements

Member

Member (2/5)

0

Reputation

  1. http://www.postgresql.org/docs/8.2/interactive/datatype-datetime.html#DATATYPE-TIMEZONES Says you can specify the full description and it will account for DST.. but I don't understand how and can't find any examples of this even though it seems like it should be a common thing?
  2. Right now I get an error because of the America/Chicago. If I remove that the values are stored as such: 2011-12-29 00:00:00+00 Sandpeep: Thanks for the help, but Postgresql does not support Unix timestamps
  3. Hi, I am writing a script for invoicing various contractor jobs. I have fields for date assigned and date completed. Both are timestamp with timezone columns in a postgresql table My goal is to have a cron job which selects the records from the table on the dates the invoices are due and includes the proper jobs-- i.e. the ones that are completed prior to the due date and time(5PM on the first and 15th of each month) That is where I am running into confusion as to how to store the time/tz and then select it in the future so everything is correct This is what I have right now: $assignmenttype, "miles" => $miles, "notes" => $notes, "dateassigned" => "{$assignmenty1}-{$assignmentm1}-{$assignmentd1} $time1:00 America/Chicago", "datecompleted" => "{$completedassignmenty1}-{$completedassignmentm1}-{$completedd1} $time2:00 America/Chicago"); $res = pg_insert($conn, 'assignments', $invoicearray);
  4. $result = pg_query_params($this->connection, "delete from active_users where timestamp < to_timestamp($1)::TIMESTAMP", array($timeout)); Seems to be working
  5. This function is throwing the following error: invalid input syntax for type timestamp "1301297896" function removeInactiveUsers(){ if(!TRACK_VISITORS) return; $timeout = time()-USER_TIMEOUT*60; $result = pg_query_params($this->connection, "delete from active_users where timestamp < $1", array($timeout)); $this->calcNumActiveUsers(); } I know the problem is with $timeout using a php timestamp vs postgresql timestamp but I'm not sure how to fix that
  6. Great-- thanks for your help. I think I've got a better handle on it now and my test scripts are working so far.
  7. So store $saltedpass and $salt not $pass right?
  8. I would use this when the user creates a pw? And then store that in a text column in my table? How about when the user logs in?
  9. Thanks-- However, everything I've read has said md5 is not adequate. Also, have read numerous places that salting is recommended but I am uncertain of how to actually implement it.
  10. Hi, What is a good way to store passwords using php and postgresql and what columns/column types do I need to do so? I've got a table 'users' I've tried to find a straight forward answer but am confused by 'salting' etc. Thanks
  11. I take that back. while($ix <16){ var_dump($array2[$ix]); $ix++; } var_dump($array2["Walnut Creek"]); First var_dump prints out an array but the keys seem to be duplicating i.e. array2("Walnut Creek" => 1 record, "Boston" => 1 record, "Walnut Creek" => another record) Rather than array2("Walnut Creek" => 5 records, "Boston" => 3 records) When I do the second var_dump I get NULL
  12. This seems to be working: $$eventcity = $recordData['event city']; $array1[] = array(${$eventcity} => $recordData);}
  13. I am trying to sort records into 2 different 2 dimensional arrays such that I end up with something like: $array1 = array("Boston" = > array(variousrecords), "New York" = > (various records)); So far I have: $array1 = array(); $array2 = array(); while ($recordData = pg_fetch_assoc($recordresults)) { if (in_array($recordData['event city'], $marketsarray1)){ $eventcity = $recordData['event city']; $$eventcity = array($recordData);} elseif (in_array($recordData['event city'], $marketsarray2) ){ $$eventcity = array($recordData);} else { $unsorted[] = $recordData;} } How can I make $array1[$$eventcity] = array($recordData);} ?
  14. I think I've made some progress. I think I've made some progress. $marketsarray = array(array("birmingham", "bham@"), array("bridgewater", "bridgewater@"),array("coltsneck", "coltsneck@"), array("encino", "encino@"), array("grandrapids", "grandrapids@"),array("hackensack","hackensack@"), array("houston","houston@"),array("irvine","irvine@"),array("lawrenceville","lawrenceville@"),array("la", "la@"),array("nola","neworleans@"),array("palmbeach","palmbeach@"),array("pittsburgh","pittsburgh@"),array("upland", "upland@")); $leadsarray = array("birmingham" => $birmingham,"bridgewater" => $bridgewater, "coltsneck" => $coltsneck,"encino"=> $encino,"grandrapids"=> $grandrapids,"hackensack"=> $hackensack,"houston"=> $houston,"irvine"=> $irvine,"lawrenceville"=> $lawrenceville,"la"=> $la, "nola"=>$nola,"palmbeach"=> $palmbeach,"pittsburgh"=> $pittsburgh,"upland"=> $upland); $i = 0; while($i <13){ $market = $marketsarray[$i][0]; if(isset($leadsarray[$market])){ echo "<br>" . $marketsarray[$i][1]; echo "<pre>"; print_r($leadsarray[$market]); echo "</pre>"; } $i++; } This seems to be printing out the correct information with my test records I am going to wrap that loop around my pdf/email script now that I am getting the desired results Questions: Are there any issues that can be seen that might cause problems in the future? Or does this code look sound? I am going to wrap that loop around my pdf/email script now that I am getting the desired results
×
×
  • 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.