Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - mySQL time format
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

mySQL time format

 Post Reply Post Reply
Author
judo2000 View Drop Down
Groupie
Groupie
Avatar

Joined: 05 November 2002
Location: United States
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote judo2000 Quote  Post ReplyReply Direct Link To This Post Topic: mySQL time format
    Posted: 16 November 2004 at 6:34pm
HI,
I have a mySQL database with a table called classes.  One of the fields is "time" type="time".  I have an asp page that calls for classes listed in the class database depending on day and time.  I have a table with two columns.  The first column has the first three cllasses that occur after the current time and the second colum is the next three classes.  It will pull the first three classes but instead of time it gives the current date which is not entered anywhere in the database.   Below is my code.  I would appreciate any help.

<%
    Dim TodayDay, NowTime, lastTime, id
    TodayDay = WeekDayName(WeekDay(date()), false, 1)
    rs.Open "SELECT * FROM classes WHERE classes.day='" & TodayDay & "' AND classes.time >= CURRENT_TIME() ORDER BY classes.time LIMIT 3", conDB
%>
<tr>
    <td width="49%" valign="top" class="bodyTxt">
        <%
            count = 1
            DO WHILE NOT rs.EOF
                if NOT rs.EOF THEN
                    if count = 3 THEN
                        lastTime = rs("time")
                        id = rs("classID")
                        ELSE
                    END if
                    response.Write("<span class='headBox'> " & rs("className") & ": </span> " & rs("time") & "<br>")
                     Else
                END if
                count = count + 1
                rs.MoveNext
            Loop
            rs.Close  
        %>
    </td>
    <td width="2%">&nbsp;</td>
    <td width="49%" valign="top" class="bodyTxt">
        <%
            rs.Open "SELECT * FROM classes WHERE classes.day='" & TodayDay & "' ORDER BY classes.classID LIMIT 4", conDB
            DO WHILE rs.EOF
                if NOT rs("time") >= lastTime AND rs("classID") <> id THEN
                    response.Write("<span class='headBox'> " & rs("className") & ": </span> " & rs("time") & "<br>")
                    Else
                END if
                rs.MoveNext
            Loop   
            rs.Close
        %>
    </td>
</tr>

Thanks,

judo2000
If you are not willing to work hard to realize your dreams, why bother dreaming?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.