I’m learning how to use an MS Access DB with PHP. The only online tutorial I found was at:
[url]http://www.phpbuilder.com/columns/siddarth20000228.php3[/url]
I got a few errors using the code supplied in the tutorial and was able to clean things up and now get the following error:
[B]Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in query expression '$FirstName'., SQL state 37000 in SQLExecDirect[/B]
I’ve searched and haven’t been able to find a solution. Any help would be greatly appreciated.
Here’s the problem section of code from DataAccess.php:
<?php
function Enter_New_Entry($FirstName,$LastName,$PhoneNumber)
{
$cnx = odbc_connect( 'WebTutorial' , 'root', '' );
if (!$cnx)
{
Error_handler( "Error in odbc_connect" , $cnx );
}
$SQL_Exec_String = "Insert Into People (FirstName, LastName, PhoneNumber)
Values ($FirstName, $LastName, $PhoneNumber)";
$cur = odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur)
{
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
odbc_close( $cnx);
}
?>