try addcslashes(string str, string charlist). --
Best regards, George Nicolae IT Manager ___________________ PaginiWeb.com - Professional Web Design www.PaginiWeb.com "Dewey Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > I am new to PHP but not programming. I have created a simple program to get > info from a form and put it into an Access database. Moving to a different > database like MySQL is NOT an option! > > Everything works fine unless the user puts a single quote (') in one of the > form text boxes. If they do, an ODBC error is generated and my SQL > statement doesn't work. > > I know this has to do with the way PHP handles quoting, and I have tried > addslashes, magic-quotes on/off, and other methods to solve this problem, > with no solution. > > Here are my specs: > Windows 2000 > Access 2000 > PHP 4.2.1 > magic-quotes (all) = Off > > Here is the short version of my code. Please let me know where the problem > is and how to solve it. > > <html> > <body> > > <?php > $FName = $_POST['FName']; > $LName = $_POST['LName']; > > $db = odbc_connect("MyData", "", ""); > > $str_AddRecord = "INSERT INTO Alumni ([FirstName], [LastName]) VALUES > ('$FName', '$LName')"; > > if (!$resp_AddRecord = odbc_exec($db, $str_AddRecord)){ > echo "Query error! ODBC error: ", odbc_errormsg(); > } else { > print("<p class='message'>Record Posted!</p>"); > } > > odbc_close($db); > > ?> > > </body> > </html> > > TIA > > Dewey Williams > [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php