Okay so here is my source code that submits the form to the database
Code:
<?php
require("config.php");
if($_GET['action'] == 'post')
{
if($_POST['Employee_ID'] != '')
{
$ret = $db_conn->Execute("SELECT * FROM analyzer_query WHERE Employee_ID = '{$_POST['Employee_ID']}") or die("Error validating Employee ID");
$itemfields = Count("Employee_ID");
if ($itemfields <= 1)
{
error("user");
exit;
}
}
if(empty($_POST['Employee_ID']) || empty($_POST['Date']) || empty($_POST['Activity']) || empty($_POST['Miles']))
{
//if everything is not filled in than prints out error message
error("blank");
exit;
}
else
$db_conn->Execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')") or die("Error in connecting to the database");
header("Location: success.php?action=success");
}
function error($error)
{
//if error is equal to blank
if($error == 'blank')
{
echo "Please fill in all the required fields before submitting";
}
//if error is equal to blank
if($error == 'user')
{
echo "Please fill in the correct Employee ID";
}
}
?>
with the config file
Code:
<?php
$db_conn = new COM("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("./Copy of HR Employee Wellness Program.mdb").";";
$db_conn->open($connstr);
?>
and now here is the error i'm getting
Code:
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'Employee_ID = 'ff'. in F:\InetPub\wwwroot\EmployeeWellnessProgram\WellnessSubmit.php on line 9
Error validating Employee ID
Can anyone help me because i'm absolutely clueless. ???