this is where i am now, odbc.php is still the same, query.php is now like this:
<?
include 'odbc.php';
$query = odbc_exec($odbc, "SELECT * FROM Customers") or die (odbc_errormsg());
while($row = odbc_fetch_array($query)){
echo "Customer First Name: ".$row['customer_first_name']."<br />";
echo "Customer Last Name: ".$row['customer_last_name']."<br />";
echo "Customer Email: ".$row['email_address']."<br />";
echo "<hr />";
}
echo "
<FORM NAME = \"AccessInterface\" METHOD=post ACTION=\"DataAccess.php\">
Please enter the details you wish to be inserted into the Access Database.<br>
First Name:<input name=\"customer_first_name\" TYPE=\"text\" SIZE=\"25\"><br>
Last Name:<input name=\"customer_last_name\" TYPE=\"text\" SIZE=\"25\"><br>
Phone Number: <input name=\"email_address\" TYPE=\"text\" SIZE=\"25\"><br>
<INPUT type=\"Submit\">
</form>
";
odbc_close($odbc);
?>
and DataAccess.php looks like this:
<?php
$customer_first_name=$_POST['customer_first_name'];
$customer_last_name=$_POST['customer_last_name'];
$email_address=$_POST['email_address'];
include 'odbc.php';
{
$query = odbc_exec($odbc, "SELECT * FROM Customers") or die (odbc_errormsg());
$sql = "Insert Into Customers Values ('$customer_first_name', '$customer_last_name', '$email_address')";
$result_set = odbc_exec ($odbc, $sql);
if (!$result_set)
{
echo "<h1>Insert Failed</h1>";
exit;
}
}
odbc_close($odbc);
?>
but i'm getting this error message:
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same., SQL state 21S01 in SQLExecDirect in c:\phpdev\www\public\databases\source\dataaccess.php on line 11
Insert Failed