I’m having no luck with saving and loading data from database. Please HELP!!
My Scheduler HTML Code (I pulled from this example http://www.dhtmlx.com/docs/products/dhtmlxScheduler/sample_units.shtml)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><head>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Room Scheduler</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
color: #FFFFFF;
}
.style2 {
font-size: 20px;
font-weight: bold;
}
-->
</style>
</head>
<script src="codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
<script src="codebase/ext/dhtmlxscheduler_dhx_terrace.js" type="text/javascript" charset="utf-8"></script>
<script src="codebase/ext/dhtmlxscheduler_units.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="codebase/dhtmlxscheduler_dhx_terrace.css" type="text/css" title="no title" charset="utf-8">
<style type="text/css" media="screen">
html, body{
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
}
.dhx_cal_event_line.custom, .dhx_cal_event.custom div{
background-color:#fd7;
border-color:#da6;
color:#444;
}
</style>
<script type="text/javascript" charset="utf-8">
function init() {
window.resizeTo(950,700)
modSchedHeight();
var sections=[
{key:1, label:"#1 - Small Meeting Room"},
{key:2, label:"#1 - Large Conference Room"},
{key:3, label:"#2 - Small Meeting Room 1"},
{key:4, label:"#2 - Small Meeting Room 2"},
{key:5, label:"#3 - Conference Room"},
{key:6, label:"#4 - Conference Room"}
];
scheduler.locale.labels.unit_tab = "Rooms"
scheduler.locale.labels.section_custom="Assigned to";
scheduler.config.first_hour = 7;
scheduler.config.last_hour = 21;
scheduler.config.multi_day = true;
scheduler.config.details_on_create=true;
scheduler.config.details_on_dblclick=true;
scheduler.config.xml_date="%Y-%m-%d %h:%i";
scheduler.config.hour_date="%h:%i";
scheduler.templates.event_class=function(s,e,ev){ return ev.custom?"custom":""; };
scheduler.config.lightbox.sections=[
{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"custom", height:23, type:"select", options:sections, map_to:"section_id" },
{name:"time", height:72, type:"time", map_to:"auto"}
]
scheduler.createUnitsView("unit","section_id",sections);
scheduler.init('scheduler_here',null,"unit");
scheduler.load("codebase/data/connector.php");
var dp = new dataProcessor("codebase/data/connector.php");
dp.init(scheduler);
}
</script>
<body onload="init();" onresize="modSchedHeight()">
<!-- info block
href-prev
href-next
title
desc-short
desc-long
-->
<script>
function modSchedHeight(){
var headHeight = 100;
var sch = document.getElementById("scheduler_here");
sch.style.height = (parseInt(document.body.offsetHeight)-headHeight)+"px";
var contbox = document.getElementById("contbox");
contbox.style.width = (parseInt(document.body.offsetWidth)-300)+"px";
}
</script>
<div class="style1" style="height:20px;background-color:#E58924;border-bottom:5px solid #828282; padding:5px; padding-bottom:10px;">
<div class="style2">Room Scheduler</div>
<div id="contbox" style="float:left;color:white;margin:22px 75px 0 75px; overflow:hidden;font: 17px Arial,Helvetica"></div>
</div>
<!-- end. info block -->
<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button"> </div>
<div class="dhx_cal_next_button"> </div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
<div class="dhx_cal_tab" name="unit_tab" style="right:280px;"></div>
<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
</div>
<div class="dhx_cal_header"> </div>
<div class="dhx_cal_data"> </div>
</div>
</body>
</html>
My connector file (I have my real username and password loaded)
[code]
<?php require_once("../connector/scheduler_connector.php"); $res=mysql_connect("localhost","user_name","password");
mysql_select_db("database_name");
$conn = new SchedulerConnector($res);
$conn->enable_log("temp.log");
$conn->render_table("events","event_id","start_date,end_date,event_name,details");
?>[/code]
The SQL tables
DROP TABLE IF EXISTS events
;
CREATE TABLE IF NOT EXISTS events
(
event_id
int(11) NOT NULL AUTO_INCREMENT,
event_name
varchar(127) NOT NULL,
start_date
datetime NOT NULL,
end_date
datetime NOT NULL,
details
text NOT NULL,
PRIMARY KEY (event_id
)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1261152023 ;
What am I doing wrong?