
May 6th, 2011, 06:47 AM
|
 |
*Programmer In Training*
|
|
Join Date: Mar 2005
Location: SE London
Posts: 369
  
Time spent in forums: 1 Week 10 h 26 m 31 sec
Reputation Power: 11
|
|
|
Day/Month keeps switching from MySQL table
Hi guys,
I have a record being chucked from a table in MySQL, and printing it out on the page, however, every so often, at the moment it seems to be happen once on a daily basis, the day/month of the date are switched.
One day it's 13/04/2011, then the next day it's 04/13/2011.
Here's my code:
Code:
<%
Dim rsAllBlogsMain
Dim rsAllBlogsMain_cmd
Dim rsAllBlogsMain_numRows
Dim category
If (Request.QueryString("c") <> "") Then
category = "page_parent_id = " & Request.QueryString("c") & " AND "
End If
Set rsAllBlogsMain_cmd = Server.CreateObject ("ADODB.Command")
rsAllBlogsMain_cmd.ActiveConnection = MM_db_STRING
rsAllBlogsMain_cmd.CommandText = "SELECT * FROM ita02.page WHERE " & category & " page_category = ?"
rsAllBlogsMain_cmd.Prepared = true
rsAllBlogsMain_cmd.Parameters.Append rsAllBlogsMain_cmd.CreateParameter("param1", 19, 1, -1, rsAllBlogsMain__MMColParam) ' adDouble
Set rsAllBlogsMain = rsAllBlogsMain_cmd.Execute
rsAllBlogsMain_numRows = 0
%>
<%
Dim Repeat12__numRows
Dim Repeat12__index
Repeat12__numRows = 4
Repeat12__index = 0
rsWCMIH_numRows = rsWCMIH_numRows + Repeat12__numRows
%>
<%
Dim Repeat15__numRows
Dim Repeat15__index
Repeat15__numRows = -1
Repeat15__index = 0
rsAllBlogsMain_numRows = rsAllBlogsMain_numRows + Repeat15__numRows
%>
<%
Dim checkDate
checkDate = 0
While ((Repeat15__numRows <> 0) AND (NOT rsAllBlogsMain.EOF))
Dim blogNumber2
Dim thisValue
thisValue = rsAllBlogsMain.Fields.Item("page_date").Value
Dim var11
var11 = split(thisValue,"/")
if (var11(1) = 01) THEN realMonth2 = "January" Else
if (var11(1) = 02) THEN realMonth2 = "February" Else
if (var11(1) = 03) THEN realMonth2 = "March" Else
if (var11(1) = 04) THEN realMonth2 = "April" Else
if (var11(1) = 05) THEN realMonth2 = "May" Else
if (var11(1) = 06) THEN realMonth2 = "June" Else
if (var11(1) = 07) THEN realMonth2 = "July" Else
if (var11(1) = 08) THEN realMonth2 = "August" Else
if (var11(1) = 09) THEN realMonth2 = "September" Else
if (var11(1) = 10) THEN realMonth2 = "October" Else
if (var11(1) = 11) THEN realMonth2 = "November" Else
if (var11(1) = 12) THEN realMonth2 = "December" End If
blogNumber2 = (rsAllBlogsMain.Fields.Item("page_id").Value)
if (rsAllBlogsMain.Fields.Item("page_parent_id").Value <> "312") THEN
if (checkDate = 0) THEN
%>
<div style="margin-bottom:5px; font-weight:bold; font-size:1.8em;" class="b2B"><%=realMonth2%> <%=var11(2)%></div>
<%
End If
%>
<div style="width:116px; height:135px; float:left; margin-right:6px;">
<div><a href="#" class="blog<%=blogNumber2%>"><img src="<%=tNG_showDynamicThumbnail("", "/uploads/photos/", "{rsAllBlogsMain.image01}", 116, 97, false)%>" /></a></div>
<div class="b2L"><%=thisValue%></div>
<div style="font-size:1em;" class="b2B"><%=(rsAllBlogsMain.Fields.Item("page_title").Value)%></div>
<div style="font-size:1em;" class="b2B">heading</div>
</div>
<script type="text/javascript">
$(".blog<%=blogNumber2%>").click(function(){
$("#blogpopin").fadeIn();
$(".closeAllPopin").hide();
$("#blogPopinContent<%=blogNumber2%>").fadeIn();
});
</script>
<%
End If
Repeat15__index=Repeat15__index+1
Repeat15__numRows=Repeat15__numRows-1
checkDate = 1
rsAllBlogsMain.MoveNext()
On Error Resume Next
Dim thatValue
Dim var1
Dim realMonth
thatValue = rsAllBlogsMain.Fields.Item("page_date").Value
var1 = split(thatValue,"/")
if (var1(1) = 01) THEN realMonth = "January" Else
if (var1(1) = 02) THEN realMonth = "February" Else
if (var1(1) = 03) THEN realMonth = "March" Else
if (var1(1) = 04) THEN realMonth = "April" Else
if (var1(1) = 05) THEN realMonth = "May" Else
if (var1(1) = 06) THEN realMonth = "June" Else
if (var1(1) = 07) THEN realMonth = "July" Else
if (var1(1) = 08) THEN realMonth = "August" Else
if (var1(1) = 09) THEN realMonth = "September" Else
if (var1(1) = 10) THEN realMonth = "October" Else
if (var1(1) = 11) THEN realMonth = "November" Else
if (var1(1) = 12) THEN realMonth = "December" End If
if (var1(1) <> var11(1)) THEN
if (thatValue <> "") THEN
%><div class="clear"></div>
<div style="margin-bottom:5px; border-top:1px dashed #000; padding-top:5px; margin-top:20px; font-weight:bold; font-size:1.8em;" class="b2B"><%=realMonth%> <%=var1(2)%></div><%
End If
End If
Wend
%>
<!-- loop this -->
Bold is the line i'm assigning the date value to.
As you can see, im splitting this up into dd/mm/yyyy but because the day and month keeps switching the code that categorizes them just is not working.
Any ideas?
Thanks,
Joe.
|