Ajax Event Calendar Support Product Page

In progress

Calendar Not Showing Events ASP/MYSQL

Reported 16 Feb 2013 13:57:27
1
has this problem
16 Feb 2013 13:57:27 karl hemmings posted:
Hi there,

I have followed the instruction for creating a dynamic events calendar but none of the events are showing.

here is the link to the calendar:

www.therapytrainingschool.com/1events.asp

Here is the calendar_get_events1.asp content


<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../#####/#######(i have edited this out for security reasons).asp" -->
<!--#include file="../Scriptlibrary/JSON_latest.asp"-->
<!--#include file="../Scriptlibrary/JSON_UTIL_latest.asp"-->
<% 
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
'handler="data1mysql"
'table="`data1tts.coursedates`"
'title="`trainingname`"
'start="`coursedate`"
'stop="`theenddate`"
'description=""
'type=""
'link=""
'event_id="`ID`"
'db_type="mysql"
Dim dmxEventsRs
Dim dmxEventsRs_cmd
Dim dmxEventsRs_numRows
Dim request_Start, request_Stop

request_Start = Request.QueryString("start")
request_Stop = Request.QueryString("stop")
IF isEmpty(request_Start) THEN
  Response.Status = "400 Bad Request"
  Response.Write "Start is required"
  Response.End
ELSEIF NOT isNumeric(request_Start) THEN
  Response.Status = "400 Bad Request"
  Response.Write "Start should be a number"
  Response.End
ELSEIF  isEmpty(request_Stop) THEN
  Response.Status = "400 Bad Request"
  Response.Write "Stop is required"
  Response.End
ELSEIF NOT isNumeric(request_Stop) THEN
  Response.Status = "400 Bad Request"
  Response.Write "Stop should be a number"
  Response.End
ELSE
  Set dmxEventsRs_cmd = Server.CreateObject ("ADODB.Command")
  dmxEventsRs_cmd.ActiveConnection = MM_data1mysql_STRING
  dmxEventsRs_cmd.CommandText = "SELECT `trainingname` AS title, `coursedate` AS start, `theenddate` AS stop , `ID` AS event_id FROM `data1tts.coursedates` WHERE `coursedate` <= ? AND (`theenddate` >= ? OR (`theenddate` IS NULL AND `coursedate` >= ?))"
  dmxEventsRs_cmd.Parameters.Append dmxEventsRs_cmd.CreateParameter("@stop", 3, 1, , request_Stop)
  dmxEventsRs_cmd.Parameters.Append dmxEventsRs_cmd.CreateParameter("@start", 3, 1, , request_Start)
  dmxEventsRs_cmd.Parameters.Append dmxEventsRs_cmd.CreateParameter("@start2", 3, 1, , request_Start)
  dmxEventsRs_cmd.Prepared = true  
  dim rsJson, cb 
  set rsJson = QueryToJSON(dmxEventsRs_cmd, "")
  cb = Request.QueryString("callback")
  If cb <> "" Then  
	  Response.Write cb & "("& rsJson.jsString &");"
  Else
    Response.Write rsJson.jsString 
  End If	
END IF
%>


And here the code from the 1events.asp

<script type="text/javascript">
  // <![CDATA[
 jQuery(document).ready(
   function()
     {
       jQuery("#dmxAjaxCalendar1").dmxAjaxCalendar(
         {"id": "dmxAjaxCalendar1", "events_type": [{"number": 0, "name": "Type 1", "color": "#000000", "background_color": "#FFD700", "border_color": "#FFD700"}, {"number": 1, "name": "Type 2", "color": "#000000", "background_color": "#98FB98", "border_color": "#98FB98"}, {"number": 2, "name": "Type 3", "color": "#000000", "background_color": "#4169E1", "border_color": "#4169E1"}], "ajax_feeds": [{"url": "calendar_ajax/calendar_get_events1.asp"}], "week_start": 1}
       );
     }
 );
  // ]]>
</script>


Your help/advice would be very much appreciated.

Replies

Replied 18 Feb 2013 08:08:51
18 Feb 2013 08:08:51 Miroslav Zografski replied:
Hello Karl,

The calendar_get_events1.asp returns empty json object. Please, check if that database query returns any results.

Regards.
Replied 18 Feb 2013 10:52:22
18 Feb 2013 10:52:22 karl hemmings replied:
Hi Miroslav,

The database query returns no results.

I have uploaded a test file for you to see the results:

www.webzen.co.uk/1.asp

The code as follows:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="#####/#####" (edited out for security reasons) -->
<
%Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_GianConn_STRING
Recordset1_cmd.CommandText = "SELECT `trainingname` AS title, `coursedate` AS start, `theenddate` AS stop , `ID` AS event_id FROM `data1tts.coursedates` WHERE `coursedate` <= ? AND (`theenddate` >= ? OR (`theenddate` IS NULL AND `coursedate` >= ?))" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>
<
%Recordset1.Close()
Set Recordset1 = Nothing
%>

Replied 21 Feb 2013 20:44:12
21 Feb 2013 20:44:12 karl hemmings replied:
Hi again... any update for me Miroslav?
Replied 25 Feb 2013 12:08:55
25 Feb 2013 12:08:55 karl hemmings replied:
Hi Miroslav, it's been 1 week since I replied to your question.

It would be appreciated if you could provide further support and a solution to the problem.

Kind regards,
Karl
Replied 25 Feb 2013 12:33:09
25 Feb 2013 12:33:09 Miroslav Zografski replied:
Hello Karl,

Excuse me for the late response.
Please try this query to database:

SELECT `trainingname` AS title, `coursedate` AS start, `theenddate` AS stop , `ID` AS event_id FROM `data1tts.coursedates` WHERE `coursedate` <= 1364169600 AND (`theenddate` >= 1361750400 OR (`theenddate` IS NULL AND `coursedate` >= 1364169600))


Tanks, regards.
Replied 25 Feb 2013 12:49:11
25 Feb 2013 12:49:11 karl hemmings replied:
Hi there,

I have implemented the code, but still no results

www.therapytrainingschool.com/1events.asp

Best regards,
Karl
Replied 25 Feb 2013 13:33:56
25 Feb 2013 13:33:56 Miroslav Zografski replied:
Hello Karl,

That query was for you to set in the www.webzen.co.uk/1.asp file. that was testing the database query.

regards.
Replied 25 Feb 2013 14:00:49
25 Feb 2013 14:00:49 karl hemmings replied:
Hi Miroslav,

Yes I've implemented the code into the page and also

It is now showing another error message.

The database has lots of course dates with all fields having appropriate data, but the page shows an error.

here is the code for 1.asp


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="#####/#####.asp" -->
<
%Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_GianConn_STRING
Recordset1_cmd.CommandText = "SELECT `trainingname` AS title, `coursedate` AS start, `theenddate` AS stop , `ID` AS event_id FROM `coursedates` WHERE `coursedate` <= 1364169600 AND (`theenddate` >= 1361750400 OR (`theenddate` IS NULL AND `coursedate` >= 1364169600))" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<%=(Recordset1.Fields.Item("title").Value)%><br />
<%=(Recordset1.Fields.Item("start").Value)%><br />
<%=(Recordset1.Fields.Item("stop").Value)%><br />
<%=(Recordset1.Fields.Item("event_id").Value)%>
</body>
</html>
<
%Recordset1.Close()
Set Recordset1 = Nothing
%>



regards
Karl
Replied 25 Feb 2013 14:20:06
25 Feb 2013 14:20:06 karl hemmings replied:
Hi again,

As a comparison I have created this page that shows that the data is in the database:

www.webzen.co.uk/1b.asp


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="#####/#####.asp" -->
<
%Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_GianConn_STRING
Recordset1_cmd.CommandText = "SELECT `trainingname` AS title, `coursedate` AS start, `theenddate` AS stop , `ID` AS event_id FROM `coursedates` WHERE `coursedate` <= now()" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<
%Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
%>
  <p><%=(Recordset1.Fields.Item("title").Value)%>&nbsp;<%=(Recordset1.Fields.Item("start").Value)%>&nbsp;<%=(Recordset1.Fields.Item("stop").Value)%>&nbsp;<%=(Recordset1.Fields.Item("event_id").Value)%></p>
  <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>

</body>
</html>
<
%Recordset1.Close()
Set Recordset1 = Nothing
%>

Replied 26 Feb 2013 10:40:12
26 Feb 2013 10:40:12 karl hemmings replied:
Hi Miroslav

Any further thoughts since my last two replies?

Regards
Replied 27 Feb 2013 11:40:57
27 Feb 2013 11:40:57 karl hemmings replied:
Hi Miroslav

Any further thoughts since my last two replies?

I do need a solution to this asap please

Regards
Replied 05 Mar 2013 09:16:06
05 Mar 2013 09:16:06 Miroslav Zografski replied:
Hello Karl,

I'm sorry for the late response.
So you are using ASP with MySQL is that so?

Regards.
This reply was removed on 3/5/2013 10:02:35 AM.
See the changelog
Replied 05 Mar 2013 10:03:03
05 Mar 2013 10:03:03 karl hemmings replied:
Yes that's right.

I have amended the recordset filter and got it to work.

The problem was with the script that your extension automatically creates. Specifically it was this part of the code that did not work:

So by omitting that section of the code from the filter it now works fine.

"WHERE `coursedate` <= 1364169600 AND (`theenddate` >= 1361750400 OR (`theenddate` IS NULL AND `coursedate` >= 1364169600))"



best wishes,

Reply to this topic