ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 6th, 2011, 06:47 AM
josephman1988's Avatar
josephman1988 josephman1988 is offline
*Programmer In Training*
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: SE London
Posts: 369 josephman1988 User rank is Corporal (100 - 500 Reputation Level)josephman1988 User rank is Corporal (100 - 500 Reputation Level)josephman1988 User rank is Corporal (100 - 500 Reputation Level)josephman1988 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Week 10 h 26 m 31 sec
Reputation Power: 11
Send a message via MSN to josephman1988
Facebook
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%>&nbsp;<%=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%>&nbsp;<%=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.

Reply With Quote
  #2  
Old May 6th, 2011, 04:05 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 22 m 8 sec
Reputation Power: 4445
Sounds like you have mismatched locale settings somewhere. You could try adding a codepage setting in your asp page.
Comments on this post
josephman1988 agrees: Hit the nail on the head!
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #3  
Old May 10th, 2011, 04:02 AM
josephman1988's Avatar
josephman1988 josephman1988 is offline
*Programmer In Training*
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: SE London
Posts: 369 josephman1988 User rank is Corporal (100 - 500 Reputation Level)josephman1988 User rank is Corporal (100 - 500 Reputation Level)josephman1988 User rank is Corporal (100 - 500 Reputation Level)josephman1988 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Week 10 h 26 m 31 sec
Reputation Power: 11
Send a message via MSN to josephman1988
Facebook
That was exactly it thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Day/Month keeps switching from MySQL table

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap