contraboybish Posted December 11, 2009 Share Posted December 11, 2009 I'm trying to INSERT a new record into an ACCESS DB using PHP from a form, this is the code l have so far........ $heading = $_POST['heading']; $story = $_POST['story']; $odbc = odbc_connect ('logisticsdb', 'root', '') or die('Could Not Connect to ODBC Database!'); $sql = "INSERT INTO Search (sHeading, sDescription) VALUES ('$heading', '$story')"; odbc_exec($odbc_connection, $sql) or die(); odbc_close($odbc); But i'm getting the following error....... Warning: odbc_exec() expects parameter 1 to be resource, null given in C:\xampp\htdocs\lbm\searchupdate.php on line 8 What a l missing? Link to comment https://forums.phpfreaks.com/topic/184825-insert-into-acess-db/ Share on other sites More sharing options...
rajivgonsalves Posted December 12, 2009 Share Posted December 12, 2009 you give odbc_connection but there is no variable odbc connection however there is a variable $odbc so your code should be odbc_exec($odbc, $sql) or die(); Link to comment https://forums.phpfreaks.com/topic/184825-insert-into-acess-db/#findComment-975732 Share on other sites More sharing options...
contraboybish Posted December 12, 2009 Author Share Posted December 12, 2009 Thankyou so much, it worked :-) Many Thanks Link to comment https://forums.phpfreaks.com/topic/184825-insert-into-acess-db/#findComment-975884 Share on other sites More sharing options...
contraboybish Posted December 12, 2009 Author Share Posted December 12, 2009 It works fine on localhost but now that i have downloaded it to my server i get this error....... Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in d:\inetpub\....com\web\content\searchupdate.php on line 9 Any thoughts :-( Link to comment https://forums.phpfreaks.com/topic/184825-insert-into-acess-db/#findComment-975890 Share on other sites More sharing options...
rajivgonsalves Posted December 12, 2009 Share Posted December 12, 2009 this is a configuration problem with the user permission you will have to google it Link to comment https://forums.phpfreaks.com/topic/184825-insert-into-acess-db/#findComment-975894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.