INSERT INTO ACESS DB

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
bishmedia
Forum Newbie
Posts: 17
Joined: Sat Nov 28, 2009 3:39 pm

INSERT INTO ACESS DB

Post by bishmedia »

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........

Code: Select all

 
    $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?
bishmedia
Forum Newbie
Posts: 17
Joined: Sat Nov 28, 2009 3:39 pm

Re: INSERT INTO ACESS DB

Post by bishmedia »

I got it to work by changing $odbc_connection to $odbc :-)

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 :-(
Post Reply