need the time, not datetime | Newbie | | Join Date: Jan 2009 Location: TX
Posts: 16
| |
hello, i need some help with getting time out of a mysql db.
I have a page that lets you enter in your name and submit to a mysql db. In the db the table row is called appt_time and has a Datatype of TIME, with default value of '00:00:00'. this works fine to get the time the record is entered, I do not need the date at all. A sample of the data is 'G .Beck', 14:30:00
Then i have a seperate page that gets this data, but the time suddenly has todays date attached, becoming '8/11/2009 2:30 PM'. I can remove todays date with something like - (replace(rs("Appt_Time"),d_today,"")
but this results in ' 2:30 PM', note the white space in the front of the time, it is messing all manner of other things up and is therefore not acceptable.
How do i just get just '2:30 PM' on my page?
Thanks
|  | Expert | | Join Date: Oct 2008 Location: Bristol, United Kingdom
Posts: 145
| | | re: need the time, not datetime
Hi,
Here's one way: -
intSpace = instr(rs("Appt_Time")," ")
-
-
Appt_Time = TimeValue(right(rs("Appt_Time"),len(rs("Appt_Time"))-intSpace))
-
-
Response.Write Appt_Time
-
There are other methods but there isn't an SQL Server app where I am at the moment that I can play with.
Gaz
| | Newbie | | Join Date: Jan 2009 Location: TX
Posts: 16
| | | re: need the time, not datetime
I need more help with this issue:
In my mySQL db my column has type of TIME. When I enter a time the DB records it as ‘14:30:00’. When my asp page calls it and it becomes ‘10/09/2009 2:30:00 PM’. I use GazMathias’s code and replace the PM/AM to get ‘2:30:00’.
The problem is that if a user edits/updates the data on the page, the time gets recorded as ’02:30:00’ note that this is now AM, not PM.
How do I get around this?
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: need the time, not datetime
Hello Path9898,
Use the "FormatDateTime" function.
<%Response.Write(formatdatetime(Now(), 4))%>
Post your code if you need more help. That way our examples can fit within your code better.
Hope that helps,
CroCrew~
| | Newbie | | Join Date: Jan 2009 Location: TX
Posts: 16
| | | re: need the time, not datetime
CroCrew, thanks for the reply, I hope this all makes sence.
here is the script I to determine the time on the local PC rather then the server time - <script type = "text/JavaScript">
-
function addTimeOption()
-
{
-
var customer_arrivaltime = document.FRMadd_customer.customer_arrivaltime;
-
var thetime;
-
var d = new Date();
-
thetimeFull = d.toLocaleTimeString()
-
thetimeStripped = d.toLocaleTimeString().replace(" AM", "").replace(" PM", "");
-
var newOptn = document.createElement("OPTION");
-
newOptn.text = thetimeFull;
-
NewOptn.value = thetimeStripped;
-
newOptn.selected = true;
-
customer_arrivaltime.options.add(newOptn);
-
}
-
</script>
it gets added to the botom of a drop down list of times that are formatted like this - <option value="18:30:00">6:30 PM</option>
and gets submitted to the database as ‘10/09/2009 2:30:00 PM’
this is how the data is displayed on webpage - <% sqlstmt = "SELECT Customer_Name, tbl_lmz_Advisor_Names.advisor_name, tbl_lmz_Advisor_Names.advisor_phone, customer_arrivaltime, customer_departtime FROM tbl_lmz_service_waiters, tbl_lmz_Advisor_Names WHERE tbl_lmz_service_waiters.business_GUID='"& URLBusiness_GUID &"' AND tbl_lmz_Advisor_Names.advisor_GUID = tbl_lmz_service_waiters.customer_advisorGUID ORDER BY customer_departtime ASC;"
-
-
rs.open sqlstmt, conn, 1
-
Do while not Rs.EOF
-
strCustomer_Name = rs("Customer_Name")
-
stradvisor_name = rs("advisor_name")
-
stradvisor_phone = rs("advisor_phone")
-
intSpace = instr(rs("customer_arrivaltime")," ")
-
strcustomer_arrivaltime = replace(TimeValue(right(rs("customer_arrivaltime"),len(rs("customer_arrivaltime"))-intSpace)),":00 "," ")
-
intSpace = instr(rs("customer_departtime")," ")
-
strcustomer_departtime = replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ")
-
%>
-
<tr>
-
<td align="center" ><b><%=strCustomer_Name %></b></td>
-
<td align="center" ><%=stradvisor_name %></td>
-
<td align="center" ><%=stradvisor_phone %></td>
-
<td align="center" ><%=strcustomer_arrivaltime %></td>
-
<td align="center" ><%=strcustomer_departtime %></td>
-
-
</tr>
-
<% Rs.MoveNext
-
loop
-
rs.close
-
%>
-
-
It is displayed as '2:30 PM’
the problem is that if the data is edited on a seperate page, -
<% Dim strcustomer_departtime : strcustomer_departtime = replace(replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace))," AM","")," PM","")
-
intSpace = instr(rs("customer_departtime")," ")
-
Dim strStrippeddeparttime : strStrippeddeparttime = replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ") %>
-
-
<select name="customer_departtime">
-
<option value="<%= strcustomer_departtime %>" Selected><%= strStrippeddeparttime %></option>
-
<option value="01:03:00">other options</option>
-
<option value="01:04:00">more options</option>
-
</select>
-
it gets formatted to get it back into datetime format and is resaved in the database as '02:30:00'
how do i display it as 2:30 PM, but automatically make sure that it is saved as 14:30:00?
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: need the time, not datetime
Hello Path9898,
I am failing to understand why you are doing this.
Is this a three page solution?
Do the time values that go into the “Options” come from a database query?
But here is a way to do what you’re asking: -
<%
-
Response.Write(Replace(formatdatetime(Hour(Now()) & ":" & Minute(Now()), 3),":00 "," "))
-
Response.Write("<br />")
-
Response.Write(formatdatetime(Hour(Now()) & ":" & Minute(Now()), 4) & ":00")
-
%>
-
Hope this helps,
CroCrew~
| | Newbie | | Join Date: Jan 2009 Location: TX
Posts: 16
| | | re: need the time, not datetime
It is a 3 page solution to show appointment times for customers. The first page (add.asp) to enter to the data, a second (edit.asp) to update the data and the third to display (display.asp) the page on a screen in a public area.
The selected value in the option field does come from the database row time value, but additional appointment times are available as options in case an appointment time must be adjusted to an earlier or later time.
This all worked great until 2 things happened:
1) I was running it on MS SQL and it handled time formatting a lot smother then mySQL seems to.
2) I was using the server time (Central time zone) to enter the appointment time on add.asp. Then I ended up with a customer on Eastern Time so the submitted times were an hour out.
ever since these events i have been hacking my way around the time field trying to get a smooth way of doing this.
I do not understand how / where to use the code you have provided. I think you are saying that it should be on add.asp, but then it will be server local time right?
|  | Expert | | Join Date: Jan 2008 Location: Michigan
Posts: 338
| | | re: need the time, not datetime
Hello Path9898,
Can you post the code for all three pages? It would help in getting you a solution to your problem.
CroCrew~
| | Newbie | | Join Date: Jan 2009 Location: TX
Posts: 16
| | | re: need the time, not datetime
CroCrew, here are the 3 pages. thanks add.asp - <%@ Language = "VBScript"%>
-
-
<!--#include file="ops/inc_connectionstring.asp"-->
-
-
<%
-
Dim lngRecsAffected
-
Dim strSQL
-
Dim strcustomer_name
-
Dim strcustomer_helpername
-
Dim strcustomer_helperphone
-
Dim strcustomer_departtime
-
Dim strcustomer_arrivaltime
-
Dim URLBusiness_GUID : URLBusiness_GUID = request.querystring("DealerGUID")
-
%>
-
<% 'script to determine the time on the local PC rather then the server time
-
' note newOptn.text = "Here Now"; this can contain text instead of the time. %>
-
<script type = "text/JavaScript">
-
function addTimeOption()
-
{
-
var customer_arrivaltime = document.FRMadd_customer.customer_arrivaltime;
-
var thetime;
-
var d = new Date();
-
thetimeFull = d.toLocaleTimeString()
-
thetimeStripped = d.toLocaleTimeString().replace(" AM", "").replace(" PM", "");
-
-
var newOptn = document.createElement("OPTION");
-
newOptn.text = thetimeFull;
-
newOptn.value = thetimeStripped;
-
newOptn.selected = true;
-
customer_arrivaltime.options.add(newOptn);
-
}
-
</script>
-
<% 'end script to determine the time on the local PC %>
-
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
-
<html>
-
<head>
-
<title>Zone - Add A New Waiter</title>
-
<link rel="stylesheet" href="<%= strURL %>/site.css" type="text/css">
-
<link rel="shortcut icon" href="favicon.ico">
-
<meta http-equiv="refresh" content="600">
-
</head>
-
<BODY class="page_bg" onLoad="addTimeOption(); ">
-
-
-
-
<table class="management_tables_border" align="center">
-
-
<tr><td>
-
<table>
-
<tr><td>Enter your waiting customer's name in the format of first intial last name.
-
<br>Your local time will appear at the top of the 'Select Time In:' list, you can change it if the customer arrived some time ago.<br><br>
-
</td></tr>
-
</table>
-
</td></tr>
-
-
<tr><td>
-
-
<table align="center" height="100%" bgcolor="white" width="100%" >
-
<form name="FRMadd_customer" method="post" onsubmit="return Form_Validator(this)">
-
<input type="hidden" name="action" value="Save Form Data">
-
-
-
<%
-
' See if we have any info to process.
-
If Request.Form("action") <> "Save Form Data" and strTo = "" Then
-
' Show the form
-
%>
-
-
<tr>
-
<td class="body" align="right" width="180"><strong>Enter Customer Name:</strong></td>
-
<td><input type="text" maxlength="15" rows="1" name="Customer_Name" size="16"></td>
-
</tr>
-
-
-
<tr>
-
<td class="body" align="right"><strong>Select a helper:</strong></td>
-
<%
-
' get the name and phone number of the helper out of the DB to save user input
-
sqlstmt = "SELECT DISTINCT helper_GUID, helper_name, helper_phone FROM tbl_z1_helper_Names WHERE business_GUID='"& URLBusiness_GUID &"' ORDER BY helper_name ASC;"
-
'' if no helpers exist the customer_add.asp will crap out.
-
rs.open sqlstmt, conn, 1
-
Dim strhelper_name : strhelper_name = rs("helper_name")
-
Dim strhelper_phone : strhelper_phone = rs("helper_phone")
-
Dim strhelper_GUID : strhelper_GUID = rs("helper_GUID")
-
response.write "<td>"
-
response.write "<SELECT id=""helper"" name=""Get_helper_GUID"" size=""1"">"
-
-
Do while not Rs.EOF
-
Response.Write("<option value=""" & rs("helper_GUID") & "$" & rs("helper_name") & """>" & rs("helper_name") & "</option>")
-
Rs.MoveNext
-
loop
-
response.write "</SELECT>" response.write "</td>"
-
rs.Close
-
%>
-
</tr>
-
<tr>
-
<td class="body" align="right"><strong>Select Time In:</strong></td>
-
<td>
-
<select name="customer_arrivaltime">
-
<option value="5:30:00">5:30 AM</option> <option value="5:45:00">5:45 AM</option>
-
<option value="6:00:00">6:00 AM</option> <option value="6:15:00">6:15 AM</option>
-
<option value="6:30:00">6:30 AM</option> <option value="6:45:00">6:45 AM</option>
-
<option value="7:00:00">7:00 AM</option> <option value="7:15:00">7:15 AM</option>
-
<option value="7:30:00">7:30 AM</option> <option value="7:45:00">7:45 AM</option>
-
<option value="8:00:00">8:00 AM</option> <option value="8:15:00">8:15 AM</option>
-
<option value="8:30:00">8:30 AM</option> <option value="8:45:00">8:45 AM</option>
-
<option value="9:00:00">9:00 AM</option> <option value="9:15:00">9:15 AM</option>
-
<option value="9:30:00">9:30 AM</option> <option value="9:45:00">9:45 AM</option>
-
<option value="10:00:00">10:00 AM</option> <option value="10:15:00">10:15 AM</option>
-
<option value="10:30:00">10:30 AM</option> <option value="10:45:00">10:45 AM</option>
-
<option value="11:00:00">11:00 AM</option> <option value="11:15:00">11:15 AM</option>
-
<option value="11:30:00">11:30 AM</option> <option value="11:45:00">11:45 AM</option>
-
<option selected="selected" value="12:00:00">12:00 PM</option> <option value="12:15:00">12:15 PM</option>
-
<option value="12:30:00">12:30 PM</option> <option value="12:45:00">12:45 PM</option>
-
<option value="13:00:00">1:00 PM</option> <option value="13:15:00">1:15 PM</option>
-
<option value="13:30:00">1:30 PM</option> <option value="13:45:00">1:45 PM</option>
-
<option value="14:00:00">2:00 PM</option> <option value="14:15:00">2:15 PM</option>
-
<option value="14:30:00">2:30 PM</option> <option value="14:45:00">2:45 PM</option>
-
<option value="15:00:00">3:00 PM</option> <option value="15:15:00">3:15 PM</option>
-
<option value="15:30:00">3:30 PM</option> <option value="15:45:00">3:45 PM</option>
-
<option value="16:00:00">4:00 PM</option> <option value="16:15:00">4:15 PM</option>
-
<option value="16:30:00">4:30 PM</option> <option value="16:45:00">4:45 PM</option>
-
<option value="17:00:00">5:00 PM</option> <option value="17:15:00">5:15 PM</option>
-
<option value="17:30:00">5:30 PM</option> <option value="17:45:00">5:45 PM</option>
-
<option value="18:00:00">6:00 PM</option> <option value="18:15:00">6:15 PM</option>
-
<option value="18:30:00">6:30 PM</option> <option value="18:45:00">6:45 PM</option>
-
<option value="19:00:00">7:00 PM</option> <option value="19:15:00">7:15 PM</option>
-
<option value="19:30:00">7:30 PM</option> <option value="19:45:00">7:45 PM</option>
-
<option value="20:00:00">8:00 PM</option>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td class="body" align="right"><strong>Select Est. Time Out:</strong></td>
-
<td>
-
<select name="customer_departtime">
-
<option value="5:30:00">5:30 AM</option> <option value="5:45:00">5:45 AM</option>
-
<option value="6:00:00">6:00 AM</option> <option value="6:15:00">6:15 AM</option>
-
<option value="6:30:00">6:30 AM</option> <option value="6:45:00">6:45 AM</option>
-
<option value="7:00:00">7:00 AM</option> <option value="7:15:00">7:15 AM</option>
-
<option value="7:30:00">7:30 AM</option> <option value="7:45:00">7:45 AM</option>
-
<option value="8:00:00">8:00 AM</option> <option value="8:15:00">8:15 AM</option>
-
<option value="8:30:00">8:30 AM</option> <option value="8:45:00">8:45 AM</option>
-
<option value="9:00:00">9:00 AM</option> <option value="9:15:00">9:15 AM</option>
-
<option value="9:30:00">9:30 AM</option> <option value="9:45:00">9:45 AM</option>
-
<option value="10:00:00">10:00 AM</option> <option value="10:15:00">10:15 AM</option>
-
<option value="10:30:00">10:30 AM</option> <option value="10:45:00">10:45 AM</option>
-
<option value="11:00:00">11:00 AM</option> <option value="11:15:00">11:15 AM</option>
-
<option value="11:30:00">11:30 AM</option> <option value="11:45:00">11:45 AM</option>
-
<option selected="selected" value="12:00:00">12:00 PM</option> <option value="12:15:00">12:15 PM</option>
-
<option value="12:30:00">12:30 PM</option> <option value="12:45:00">12:45 PM</option>
-
<option value="13:00:00">1:00 PM</option> <option value="13:15:00">1:15 PM</option>
-
<option value="13:30:00">1:30 PM</option> <option value="13:45:00">1:45 PM</option>
-
<option value="14:00:00">2:00 PM</option> <option value="14:15:00">2:15 PM</option>
-
<option value="14:30:00">2:30 PM</option> <option value="14:45:00">2:45 PM</option>
-
<option value="15:00:00">3:00 PM</option> <option value="15:15:00">3:15 PM</option>
-
<option value="15:30:00">3:30 PM</option> <option value="15:45:00">3:45 PM</option>
-
<option value="16:00:00">4:00 PM</option> <option value="16:15:00">4:15 PM</option>
-
<option value="16:30:00">4:30 PM</option> <option value="16:45:00">4:45 PM</option>
-
<option value="17:00:00">5:00 PM</option> <option value="17:15:00">5:15 PM</option>
-
<option value="17:30:00">5:30 PM</option> <option value="17:45:00">5:45 PM</option>
-
<option value="18:00:00">6:00 PM</option> <option value="18:15:00">6:15 PM</option>
-
<option value="18:30:00">6:30 PM</option> <option value="18:45:00">6:45 PM</option>
-
<option value="19:00:00">7:00 PM</option> <option value="19:15:00">7:15 PM</option>
-
<option value="19:30:00">7:30 PM</option> <option value="19:45:00">7:45 PM</option>
-
<option value="20:00:00">8:00 PM</option>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td></td>
-
<td><input type="submit" name="SubmitAction" value="Add this Customer" onClick="(document.all.customer_arrivaltime.options[document.all.customer_arrivaltime.selectedIndex].value)"></td>
-
</tr>
-
-
</table>
-
</form>
-
-
</td></tr>
-
</table>
-
-
<%
-
Else
-
-
'get the helper details from the dropdown and split out the name from the guid for seperate db fields.
-
Dim s1, strhelper_GUID1, strhelper_Name1
-
s1 = Request("Get_helper_GUID")
-
If InStr(s1, "$") > 0 Then
-
strhelper_GUID1 = Split(s1, "$")(0)
-
strhelper_Name1= Split(s1, "$")(1)
-
End If
-
-
strCustomer_Name = Replace(Request.Form("Customer_Name"),"'","''")
-
strcustomer_arrivaltime = Request.Form("customer_arrivaltime")
-
strcustomer_departtime = Request.Form("customer_departtime")
-
-
' Build our SQL String
-
strSQL = ""
-
strSQL = strSQL & "INSERT INTO tbl_z1_service_waiters "
-
strSQL = strSQL & "(gCustomer_ID, Customer_Name, customer_helperGUID, customer_arrivaltime, customer_departtime, business_GUID, creation_date, customer_helper_name) " & vbCrLf
-
strSQL = strSQL & "VALUES ("
-
strSQL = strSQL & "UUID()"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "'" & strCustomer_Name & "'"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "'" & strhelper_GUID1 & "'"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "'" & strcustomer_arrivaltime & "'"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "'" & strcustomer_departtime & "'"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "'" & URLBusiness_GUID & "'"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "now()"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "'" & strhelper_Name1 & "'"
-
strSQL = strSQL & ");"
-
-
conn.Execute strSQL, lngRecsAffected, adCmdText Or adExecuteNoRecords
-
-
Response.redirect strURL & "/control/waiter_manage_list.asp?DealerGUID=" & URLBusiness_GUID
-
-
End If
-
%>
-
-
</body>
-
</html>
-
edit.asp - <%@ Language = "VBScript"%>
-
<!--#include file="ops/inc_connectionstring.asp"-->
-
-
<%
-
Dim lngRecsAffected
-
Dim strSQL
-
Dim URLBusiness_GUID : URLBusiness_GUID = request.querystring("DealerGUID")
-
Dim URLgCustomer_ID : URLgCustomer_ID = request.querystring("CustGUID")
-
-
sqlstmt = "SELECT Customer_Name, tbl_z1_helper_Names.helper_GUID, tbl_z1_helper_Names.helper_name, customer_departtime, gCustomer_ID, tbl_z1_service_waiters.business_GUID FROM tbl_z1_service_waiters, tbl_z1_helper_Names WHERE tbl_z1_service_waiters.gCustomer_ID='"& URLgCustomer_ID &"' AND tbl_z1_helper_Names.helper_GUID = tbl_z1_service_waiters.Customer_helperGUID;"
-
-
rs.open sqlstmt, conn, 1
-
If not rs.eof then
-
Dim strcustomer_name : strcustomer_name = rs("customer_name")
-
Dim strhelper_name : strhelper_name = rs("helper_name")
-
Dim strhelper_GUID : strhelper_GUID = rs("helper_GUID")
-
-
Dim strcustomer_departtime : strcustomer_departtime = replace(replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace))," AM","")," PM","")
-
intSpace = instr(rs("customer_departtime")," ")
-
Dim strStrippeddeparttime : strStrippeddeparttime = replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ")
-
-
Dim strgCustomer_ID : strgCustomer_ID = Rs("gCustomer_ID")
-
Dim strgBusiness_GUID : strgBusiness_GUID = Rs("Business_GUID")
-
End If
-
%>
-
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
-
<html>
-
<head>
-
<title>Zone - Edit <%= strcustomer_name %>'s details</title>
-
<link rel="stylesheet" href="<%= strURL %>/site.css" type="text/css">
-
<link rel="shortcut icon" href="favicon.ico">
-
<meta http-equiv="refresh" content="0600">
-
</head>
-
<body class="page_bg">
-
-
-
<table class="management_tables_border" align="center">
-
<tr><td>
-
<table>
-
<tr><td>Enter your waiting customer's name in the format of first intial last name.
-
</td></tr>
-
</table>
-
</td></tr>
-
-
<tr><td>
-
<table align="center" height="100%" width="100%" >
-
-
<form name="frmEdit" method="post">
-
<input type="hidden" name="action" value="Save Form Data">
-
-
<%
-
' See if we have any info to process.
-
If Request.Form("action") <> "Save Form Data" and strTo = "" Then
-
' Show the form
-
%>
-
-
<tr>
-
<td class="body" align="right" width="180"><strong>Enter Customer Name:</strong></td>
-
<td><input type="text" maxlength="15" rows="1" name="customer_name" size="16" value="<%=strcustomer_name%>"></td>
-
</tr>
-
<tr>
-
<td class="body" align="right"><strong>Select a helper:</strong></td>
-
<td><input type="text" maxlength="15" rows="1" readonly name="helper_name" size="16" value="<%=strhelper_name%>"></td>
-
</tr>
-
-
<tr>
-
<td class="body" align="right"><strong>Select Est. Time Out:</strong></td>
-
<td>
-
<select name="customer_departtime">
-
<% If strcustomer_departtime = "1:01:00" Then %>
-
<option value="<%= strcustomer_departtime %>" Selected>Ready!!</option>
-
<% ElseIf strcustomer_departtime = "1:02:00" Then %>
-
<option value="<%= strcustomer_departtime %>" Selected>Washing </option>
-
<% ElseIf strcustomer_departtime = "1:03:00" Then %>
-
<option value="<%= strcustomer_departtime %>" Selected>See helper</option>
-
<% Else %>
-
<option value="<%= strcustomer_departtime %>" Selected><%= strStrippeddeparttime %></option>
-
<% End If %>
-
<% 'custom messages %>
-
<option value="01:03:00">See helper</option>
-
<option value="01:02:00">Washing</option>
-
<option value="01:01:00">Ready!!</option>
-
</select>
-
</td>
-
</tr>
-
-
<tr>
-
<td></td>
-
<td><input type="submit" name="SubmitAction" value="Update this Customer"></td>
-
</tr>
-
</table>
-
</form>
-
-
-
<%
-
Else
-
' Do our DB insert!
-
strcustomer_name = Replace(Request.Form("customer_name"),"'","''")
-
strcustomer_departtime = Request.Form("customer_departtime")
-
-
' Build our SQL String
-
strSQL = ""
-
strSQL = strSQL & "UPDATE tbl_z1_service_waiters "
-
strSQL = strSQL & "SET customer_name ='" & strcustomer_name & "'"
-
strSQL = strSQL & ", "
-
strSQL = strSQL & "customer_departtime ='" & strcustomer_departtime & "'"
-
strSQL = strSQL & "Where gCustomer_ID = '"
-
strSQL = strSQL & URLgCustomer_ID
-
strSQL = strSQL & "';"
-
-
conn.Execute strSQL, lngRecsAffected, adCmdText Or adExecuteNoRecords
-
-
response.redirect strURL & "/control/waiter_manage_list.asp?DealerGUID=" & URLBusiness_GUID
-
End If
-
-
%>
-
-
</body>
-
</html>
-
display.asp - <table class="display_table" cellspacing="1" cellpadding="3" valign="middle" align="center">
-
<tr class="displayscreen_col_header" >
-
<td>Customer</td>
-
<td>helper</td>
-
<td>Extension</td>
-
<td>Time In</td>
-
<td>Est. Time Out</td>
-
</tr>
-
<%
-
sqlstmt = "SELECT Customer_Name, tbl_z1_helper_Names.helper_name, tbl_z1_helper_Names.helper_phone, customer_arrivaltime, customer_departtime FROM tbl_z1_service_waiters, tbl_z1_helper_Names WHERE tbl_z1_service_waiters.business_GUID='"& URLBusiness_GUID &"' AND tbl_z1_helper_Names.helper_GUID = tbl_z1_service_waiters.customer_helperGUID ORDER BY customer_departtime ASC;"
-
-
rs.open sqlstmt, conn, 1
-
Do while not Rs.EOF
-
strCustomer_Name = rs("Customer_Name")
-
strhelper_name = rs("helper_name")
-
strhelper_phone = rs("helper_phone")
-
intSpace = instr(rs("customer_arrivaltime")," ")
-
strcustomer_arrivaltime = replace(TimeValue(right(rs("customer_arrivaltime"),len(rs("customer_arrivaltime"))-intSpace)),":00 "," ")
-
intSpace = instr(rs("customer_departtime")," ")
-
strcustomer_departtime = replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ")
-
%>
-
<tr>
-
<td><b><%=strCustomer_Name %></b></td>
-
<td><%=strhelper_name %></td>
-
<td><%=strhelper_phone %></td>
-
<td><%=strcustomer_arrivaltime %></td>
-
<td><% If strcustomer_departtime = "1:01 AM" Then
-
response.write ("<font color=""#339933"">Ready!!</font></td>")
-
elseIf strcustomer_departtime = "1:02 AM" Then
-
response.write ("<font color=""#0000ff"">Washing</font></td>")
-
elseIf strcustomer_departtime = "1:03 AM" Then
-
response.write ("<font color=""#cc0000"">See helper</font></td>")
-
else response.write strcustomer_departtime & "</td>"
-
End If %>
-
</tr>
-
<% Rs.MoveNext
-
loop
-
rs.close
-
%>
-
</table>
-
-
|  | Similar ASP / Active Server Pages bytes | | | Forums
Visit our community forums for general discussions and latest on Bytes
/bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,590 network members.
|