I have a class called Calendar. In that class I have a method called Cal_AddEvent. I also have a class called CMS_DB(controls actions with database). The CMS_DB is installed properly so assume it works(I included the code anyway) . This is what Cal_AddEvent contains:
/// From CMS_Calendar class
function Cal_AddEvent($CalTitle,$CalEventInfo,$CalContactName,$CalContactEmail,$CalDate,$TimeHour,$TimeMinute,$TimeSecond,$TimeDuration) {
$query = "INSERT INTO `calendar_event` ( `event_id` , `type_id` , `title` , `description` , `contactname` , `contactemail` , `eventdate` , `duration` , `icon` )
VALUES ('', '0', '" . $CalTitle . "', '" . $CalEventInfo . "', '" . $CalContactName . "', '" . $CalContactEmail . "', '" . $CalDate . " " . $TimeHour . ":" . $TimeMinute . ":" . $TimeSecond . "', '" . $TimeDuration . "', 'people.gif')";
$this->CMS_DB->DB_Query($query);
print '<font color="#009900">Event Added</font><br>';
}
/// From CMS_DB class
function DB_Query($query) {
if( ! $this->DB_IsConnected() ) {
print 'Not connected, can\'t query database';
return false;
}
else
return mysql_query($query,$this->DB_Link);
}
When I execute that portion of the code on a website it all seems to work correctly. I get the "Event Added" and everything. However when I look in the database for the newly added event, it is not there. For debugging purposes, I added a "print $query" just to make sure my query line was correct. This is what I got:
INSERT INTO calendar_event ( event_id , type_id , title , description , contactname , contactemail , eventdate , duration , icon ) VALUES ('', '0', '+Title+', '+Description+', '+Name', '+Email+', '2005-03-01 00:00:00', '00', 'people.gif')
I copied that line and used phpMyAdmin to execute it and it works properly. I am stumped. Please help!
Thanks.