rich11 Posted October 25, 2007 Share Posted October 25, 2007 Hello, I am having problems with this insert statment and I can't see what I am doing wrong. Thx, Rich <?php // This opens the connection $conn=odbc_connect('eeras','',''); // Checks to see if connection was opened if ($conn) { // Connection was opened echo "yepper"; } else { // Connection Failed echo "Nope!"; } // global variables $answer1 = $_POST["ques1"]; $sql = "INSERT INTO rich(Question1) Values('$answer1')"; $result=odbc_exec($conn, $sql); /* check for errors */ if (!odbc_exec($conn, $sql)) { /* error */ echo "Whoops"; } Link to comment https://forums.phpfreaks.com/topic/74722-solved-php-and-insert-into-access-problem/ Share on other sites More sharing options...
adam291086 Posted October 25, 2007 Share Posted October 25, 2007 What errors are you getting? Link to comment https://forums.phpfreaks.com/topic/74722-solved-php-and-insert-into-access-problem/#findComment-377747 Share on other sites More sharing options...
rich11 Posted October 25, 2007 Author Share Posted October 25, 2007 Well that is the problem... I know that the code hits this line... /* error */ echo "Whoops"; Because "Whoops" is displayed in the browser. But I don't get errors. Say like in ASP or Coldfusion displayed on the screen. I have tried using IE, Netscape and Firefox. I wish PHP would kick errors, but is doesn't or do I not ahve the browsers set up right? Rich Link to comment https://forums.phpfreaks.com/topic/74722-solved-php-and-insert-into-access-problem/#findComment-377759 Share on other sites More sharing options...
rich11 Posted October 25, 2007 Author Share Posted October 25, 2007 I have changed my insert statement to this.... $query = odbc_exec($conn, "INSERT INTO rich(Question1) Values('$answer')") or die (odbc_errormsg()); This is the error msg I get... [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. Link to comment https://forums.phpfreaks.com/topic/74722-solved-php-and-insert-into-access-problem/#findComment-377769 Share on other sites More sharing options...
adam291086 Posted October 25, 2007 Share Posted October 25, 2007 that means you need to add write permissions to the file you are attempting to write to or to the folder that contains the file(s) you are attempting to write to. Link to comment https://forums.phpfreaks.com/topic/74722-solved-php-and-insert-into-access-problem/#findComment-377773 Share on other sites More sharing options...
rich11 Posted October 25, 2007 Author Share Posted October 25, 2007 yes.. I just google that error that is what I read.. thank you for your help. It was much appreciated. Rich Link to comment https://forums.phpfreaks.com/topic/74722-solved-php-and-insert-into-access-problem/#findComment-377776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.