Last active
March 8, 2016 13:45
-
-
Save miwebguy/5371690 to your computer and use it in GitHub Desktop.
PHPHints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TRY/CATCH Format | |
| try{ | |
| $_rs = $this->db->query($searchSQL, $_bind); | |
| while ($_row = $this->db->fetch($_rs)){ | |
| # check the open date */ | |
| if (count(Core::datesBetween($_row["open_date"], date("Y-m-d"))) > 30) { | |
| $_row["open_date_desc"] = "<b style='color: red'>" | |
| .date("Y m/d",strtotime($_row["open_date"])) | |
| ."</b>"; | |
| } else $_row["open_date_desc"] = date("Y m/d",strtotime($_row["open_date"])); | |
| array_push($results, $_row); | |
| $_rowCount=$_rowCount+1; | |
| } | |
| } catch (PDOException $_e){ | |
| // $b = $query->debugDumpParams(); | |
| Core::notify('search w/o error', $searchSQL .$b. $_e->getMessage()); | |
| if ($_json) MelodicException::kill($_e); | |
| else MelodicException::exception($_e); | |
| } catch (Exception $_e){ | |
| $b = Core::toJson($_POST); | |
| //$b = $query->debugDumpParams(); | |
| Core::notify('search w/o error', $searchSQL .$b. $_e->getMessage()); | |
| if ($_json) MelodicException::kill($_e); | |
| else MelodicException::exception($_e); | |
| } | |
| SORT | |
| while ($_r = $this->db->fetch($_rs)) { | |
| array_push($sortSummary, $_r["description"]); | |
| array_push($summary, $_r); | |
| } | |
| array_multisort($sortSummary, SORT_ASC, $summary); | |
| STRPOS(haystack, needle) | |
| Check for file in include path: | |
| http://php.net/manual/en/function.stream-resolve-include-path.php | |
| CHECK FOR SYNTAX ERRORS | |
| # php -l parts_xrefradd.xhtml | |
| No syntax errors detected in parts_xrefradd.xhtml | |
| ## Convert Time Zone | |
| public function convert_time_zone($date_time, $from_tz, $to_tz) | |
| { | |
| $time_object = new DateTime($date_time, new DateTimeZone($from_tz)); | |
| $time_object->setTimezone(new DateTimeZone($to_tz)); | |
| return $time_object->format('Y-m-d g:i A T'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment