Jump to content

clay1

Members
  • Posts

    161
  • Joined

  • Last visited

    Never

Everything posted by clay1

  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
  15. Nobody can help with this? Seems like it should be pretty simple, I just need some direction
  16. I don't really have anything to show I tried doing a foreach or a while loop to try and set the email address such as: foreach($leadsarray as $filetoemail){ if(isset($birmingham)){ $email = 'birmingham@gmail.com; } elseif(isset($encino)){ $email = 'encino@gmail.com} but when print email it just prints ecino@gmail.com 14 times rather than each email address once but when I print out the loop I just get
  17. I've found if using CSV you need to change your delimiter to something that will not appear in the file. ^ for example
  18. Right now I have arrays containing the data that will be converted to PDF while ($recordData = pg_fetch_assoc($recordresults)) { if ($recordData['event city'] == 'Birmingham' || in_array($recordData['zip/postal code'], $birminghamzips)){ $birmingham[] = $recordData;} elseif ($recordData['event city'] == 'Bridgewater' || in_array($recordData['zip/postal code'], $bridgewaterzips)){ $bridgewater[] = $recordData;} Then I created another array that holds those arrays: i.e: $profilearray = array("birmingham" => $birmingham,"bridgewater" => $bridgewater The original version of the script normally will take a set of records and convert them to PDF: while($myrow = pg_fetch_assoc($result)) { $pdf->AddPage(); PDF layout code email to: soandso@gmail.com } I'm trying to place that inside a loop so that it happens once for each of the arrays that I have
  19. I've got a script which emails a pdf as an attachment I am trying to convert it to send multiple emails to different addresses from a handful of arrays To explain further: I have 14 arrays that will be converted into 14 different pdfs to be emailed to 14 different email addresses When I get to the point in the script where it would normally send off the 1 email I am trying to put that inside a loop so that after it sends the first it continues to through the rest of the arrays but I am having trouble figuring out how to get it to work properly. Any suggestions on how to go about this in an efficient manner? To be clear I'm not trying to add a second email address to 1 email.. I am trying to Create the email, send it and then loop back to send a different email to a new address
  20. Yes I want to put the profiles in the proper array and then email each array to the correct email address Does that make sense? So birmingham profiles go to birmingham@gmail.com for example
  21. I mean: $leadsarray = array($birmingham, $bridgewater, $coltsneck, $encino, $grandrapids, $hackensack, $houston, $irvine, $lawrenceville, $la, $nola, $palmbeach, $pittsburgh, $upland);
  22. Not sure if I should start a new topic or not but I will try here first So I have the records in separate arrays as such: while ($recordData = pg_fetch_assoc($recordResults)) { if (in_array($recordData['zip'], $birminghamzips)){ $birmingham[] = $recordData;} elseif (in_array($recordData['zip'], $bridgewaterzips)){ $bridgewater[] = $recordData;} I have a script that creates a pdf and sends an email that I have used for a single array that I need to convert so it will send do so for each of these arrays Can I put these arrays into a container array and then use another while loop? something like containerarray = array($zips1, zips2); while ($containerarray){ pdfscript email }
×
×
  • 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.