tekrscom
Members-
Posts
113 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
tekrscom's Achievements
Member (2/5)
0
Reputation
-
I thought I had tried that, but apparently I hadn't... thank you... worked like a charm...
-
Hi, I have been searching and searching, reading all of the different "time" related manuals on php.net and other various places, but I cannot find any information that deals with PHP manipulating a MySQL "time" field only... they are all date/time field manipulation... Inserting a time into MySQL was easy, like so... if ($_POST['TimeInAMPM'] == 'PM') { if ($_POST['TimeInHour'] != 12) { $TimeInHour = $_POST['TimeInHour'] + 12; } else { $TimeInHour = 12; } } elseif ($_POST['TimeInAMPM'] == 'AM') { $TimeInHour = $_POST['TimeInHour']; } if ($_POST['TimeOutAMPM'] == 'PM') { if ($_POST['TimeOutHour'] != 12) { $TimeOutHour = $_POST['TimeOutHour'] + 12; } else { $TimeOutHour = 12; } } elseif ($_POST['TimeOutAMPM'] == 'AM') { $TimeOutHour = $_POST['TimeOutHour']; } $TimeStarted = $TimeInHour.':'.$_POST['TimeInMinutes'].':00'; $TimeEnded = $TimeOutHour.':'.$_POST['TimeOutMinutes'].':00'; But trying to work with the time after pulling it out of the database is another story... For showing the time purposes, I'd like to look like this, 8:45 AM or 3:15 PM... So I tried a few things, such as this... $ThisTimeStarted = date("g:i A", $row['TimeStarted']); $ThisTimeEnded = date("g:i A", $row['TimeEnded']); But they didn't work... For editing purposes, I would like to be able to split the hours and minutes, so that I can match them in a select drop down box... I guess ultimately if I could figure out how to split the hour and minutes from a MySQL field with PHP, I could figure out the rest...
-
Thank you... That worked very well,... Here's the final code... <select name="DayOfWeek"> <? for ($i = 0; $i < 7 ;$i++) { $myarray[] = date("l, M j, Y", strtotime("$_SESSION[sessionWeekEndingDate]") - 24 * 3600 * (6 - $i)); } foreach($myarray as $var) { echo '<option value="', $var, '">', $var, '</option>'; } ?> </select>
-
Thank you, that definately puts me on a better track than I was... the only problem now is that, that gives the dates after the $_SESSION['SessionWeekEndingDate'], instead of the dates prior to that date...
-
Hi, I was wondering if someone could help me with this aggravating little problem I'm having... I feel like I am getting close, but as of yet, no cigar... So what I am trying to do is list all of the dates of the week, within a specified week... Here's what I got so far... The $_SESSION['SessionWeekEndingDate'] is in the standard yyyy-mm-dd format... <select name="DayOfWeek"> <? for ($i = 1; $i < 8 ;$i++) { $myarray[] = date("l, M j, Y", strtotime("$_SESSION[sessionWeekEndingDate]")); } foreach($myarray as $var) { echo '<option value="', $var, '">', $var, '</option>'; } ?> </select>
-
Well, that took away the error,... but the information it gives doesn't coincide with what's in the database... Here is the result of the DateTime field in the MySQL database... 2010-03-26 03:15:00 ... Notice the Hour is 03 ... the result with your solution gives 18 and notice the Minutes are 15 ... but the result gives 0
-
You need JavaScript help, not PHP...
-
Why not just use target="_blank", otherwise you need JavaScipt help, not PHP...
-
Could it have something to do with your exit function above?
-
Hey Everybody... PHP Version 5.2.13 I'm merely trying to get the Hours and Minutes from a MySQL DateTime field... and I'm having serious issues doing it... I was able to pull the whole time by using this code... $arrTimeToStart = explode(" ", $row['WorkOrderDateTimeToStart']); $arrTimeToComplete = explode(" ", $row['WorkOrderDateTimeToComplete']); But I need the Hours separately from the Minutes... So I tried this... But it doesn't work... $WorkOrderDateTimeToStart = getdate(date($row['WorkOrderDateTimeToStart'])); $WorkOrderDateTimeToComplete = getdate(date($row['WorkOrderDateTimeToComplete'])); $HoursToStart = $WorkOrderDateTimeToStart[hours]; $MinutesToStart = $WorkOrderDateTimeToStart[minutes]; $HoursToComplete = $WorkOrderDateTimeToComplete[hours]; $MinutesToComplete = $WorkOrderDateTimeToComplete[minutes]; if ($HoursToStart > 12) { $HoursToStart -= 12; $AMorPMtoStart = 'PM'; } else { $AMorPMtoStart = 'AM'; } if ($HoursToComplete > 12) { $HoursToStart -= 12; $AMorPMtoComplete = 'PM'; } else { $AMorPMtoComplete = 'AM'; } Here's the implementation code:... <td> <select name="HourToStart" style="width: 50px;">'; for($i=0;$i<13;$i++) { echo '<option value="'.sprintf("%02d",$i).'"'; if ($HoursToStart == sprintf("%02d",$i)) {echo ' selected';} echo '>'.sprintf("%02d",$i).'</option>'; } echo '</select> </td> <td> <select name="MinutesToStart" style="width: 50px;">'; for($i=0;$i<60;$i++) { echo '<option value="'.sprintf("%02d",$i).'"'; if ($MinutesToStart == sprintf("%02d",$i)) {echo ' selected';} echo '>'.sprintf("%02d",$i).'</option>'; } echo '</select> </td> <td> <select name="AMorPMtoStart" style="width: 50px;"> <option value="AM"'; if ($AMorPMtoStart == 'AM') {echo ' selected';} echo '>AM</option> <option value="PM"'; if ($AMorPMtoStart == 'PM') {echo ' selected';} echo '>PM</option> </select> </td> Here's the error I get... "Warning: getdate() expects parameter 1 to be long" Can anybody help me figure this out, it's driving me bonkers
-
Tried it, still doesn't work, all it does is tack on the date to the end of the From, in the email... I did notice however, that the autoresponse emails from PHPFreaks, does the exact same thing... must be something to do with PHP Mail going to Outlook...
-
It wouldn't accept the syntax the way it was, so I had to change it to this... But then when I tested it with the change, it just had the date after the From in the email... Did I do the wrong thing with your code, should it have been changed a different way? $ft=date("m-d-Y h:i a"); $headers .= "From: ".$EmailFromEmailAddress." ".$ft."\r\n";
-
Hey everybody... For some reason or another, which I can't seem to find any information about, when I send an email from a PHP form on my website, the email arrives in Outlook without a "Sent" time in the email "Reading Pane" header, unlike every other email that I have received... So I am wondering, what could possibly cause this, since ONLY these emails do this? Here's my PHP Mail code... Thanks in advance for any help... $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$EmailFromEmailAddress."\r\n"; $headers .= "Bcc: ".$EmailBccEmailAddress."\r\n"; //$headers .= "From: \"".$EmailFromName."\" <".$EmailFromEmailAddress.">\n"; //$headers .= "To: \"".$EmailToName."\" <".$EmailToEmailAddress.">\n"; //$headers .= "Bcc: \"".$EmailBccName."\" <".$EmailBccEmailAddress.">\n"; mail($EmailToEmailAddress, $EmailSubject, $EmailBody, $headers); Edit: Forgot to mention what PHP version I have... Here you go... PHP Version 5.2.9
-
*Dote* Yeah, I just seen that just about the time you replied... Now I feel stupid... Thank you very much for your reply and sorry for wasting your time...
-
MySQL 5.0.32 Hi everyone... It's been a while... But anyway, I am having problems with a multiple condition query... It keeps giving me an error... "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource" The query is as follows... $query = mysql_query("SELECT EndClients.EndClientBusinessName, Quotes.QuoteID, Quotes.QuoteTitle FROM Quotes LEFT JOIN EndClients ON Quotes.EndClientID = EndClients.EndClientID WHERE Quotes.QuoteID = '$_GET[quoteid]' AND Quotes.ITCompanyID = '$_SESSION[userID]' AND Quotes.QuoteStatus = 'Generation'") or die(mysql_error()); I know, you're probably wondering why I would be adding more conditions after already defining the ID of the row in which I am wanting,... it's merely added protection to ensure the right person is making the query and also that they're not trying to pull a row maliciously that is no longer in 'Generation' status... The whole code is as follows: <? session_start(); if ($_SESSION['Condition'] !== 'Logged' || $_SESSION['UserType'] !== 'ITCo') { header("Location: login.php"); } else { include_once "connection.php"; include_once "emailnotification.php"; $query = mysql_query("SELECT EndClients.EndClientBusinessName, Quotes.QuoteID, Quotes.QuoteTitle FROM Quotes LEFT JOIN EndClients ON Quotes.EndClientID = EndClients.EndClientID WHERE Quotes.QuoteID = '$_GET[quoteid]' AND Quotes.ITCompanyID = '$_SESSION[userID]' AND Quotes.QuoteStatus = 'Generation'") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { $TheCurrentDate = date("Y-m-d"); $query = mysql_query("UPDATE Quotes SET QuoteDate = '$TheCurrentDate', QuoteStatus = 'Pending Admin Approval' WHERE QuoteID = '$row[QuoteID]'"); ITCoSubmittedQuote_EmailAdmin($_SESSION['UserName'], $row['EndClientBusinessName'], $row['QuoteTitle']); header("itcoclientquotes.php?function=continueincompletequote&status=quotesubmitted"); } } ?>