Table structure for table `eventStudent`
--
DROP TABLE IF EXISTS `eventStudent`;
CREATE TABLE `eventStudent` (
`idStudent` int(11) NOT NULL auto_increment,
`titleStudent` varchar(128) default NULL,
`descriptionStudent` blob,
`start_monthStudent` int(11) default NULL,
`start_dayStudent` int(11) default NULL,
`start_yearStudent` int(11) default NULL,
`end_monthStudent` int(11) default NULL,
`end_dayStudent` int(11) default NULL,
`end_yearStudent` int(11) default NULL,
`emailStudent` varchar(44) default NULL,
`urlStudent` varchar(128) default NULL,
PRIMARY KEY (`idStudent`)
) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `eventStudent`
--
LOCK TABLES `eventStudent` WRITE;
UNLOCK TABLES;
This is the code I used to create the table.
if(isset($_POST['submit']))
{
include_once('db.php');
include_once('functions_student.php');
$titleStudent = ($_POST['titleStudent']);
$descriptionStudent = ($_POST['descriptionStudent']);
$start_monthStudent = (int)$_POST['start_monthStudent'];
$start_dayStudent = (int)$_POST['start_dayStudent'];
$start_yearStudent = (int)$_POST['start_yearStudent'];
$end_monthStudent = (int)$_POST['end_monthStudentStudent'];
$end_dayStudent = (int)$_POST['end_dayStudentStudent'];
$end_yearStudent = (int)$_POST['end_yearStudent'];
$emailStudent = ($_POST['emailStudent']);
$urlStudent = ($_POST['urlStudent']);
$query = "INSERT INTO eventStudent(titleStudent,descriptionStudent,start_monthStudent, start_dayStudent,start_yearStudent,end_monthStudent,end_dayStudent,end_yearStudent,emailStudent,urlStudent) VALUES ";
$query .= "('$titleStudent','$descriptionStudent',$start_monthStudent, $start_dayStudent,$start_yearStudent,$end_monthStudent,$end_dayStudent,$end_yearStudent,'$emailStudent','$urlStudent') ";
safe_query($query);
echo "
$titleStudent has been added to the database
";
}
else
{
echo "
Insertion failed
";
}
?>
This is the php code where I am trying to use the table. I added a test and am successfully connecting to the database but I get the Insertion failed message when I click on the form.
Like I said I have never used mysql before and have had training in sql many years ago and then never had to use it.
I know the problem is running the mysql. All the php forms were created before I took over and work fine. I am just trying to add another form to do the exact same thing.
Thanks for the help