ok so i have a form containing details of a movie (title, year, overview...) when i submit the form i would like to update the record in an access database.

heres what i have which does not seem to be working:

$title=$_POST['MovieTitle'];
$Year=$_POST['ProdYear'];
$trailerURL=$_POST['Trailer'];
$overview=$_POST['overview'];

$movieID = $_POST['movieID'];
$conn=odbc_connect('MyMovies','','');
$sql="UPDATE tblTitles
SET nvcLocalTitle = '" . $title . "',
    intProductionYear = '" . $Year . "',
    nvcTrailerUrl = '" . $trailerURL . "',
    ntxDescription = '" . $overview . "'
    WHERE intID =" . $movieID; 
$rs=odbc_exec($conn,$sql);

if (!$rs)
{
   exit("Error in SQL");
}

i basically just took the code i used to pull the info from the database and changed the SQL query to be an update query. it does not seem to be working so what do i need to change?

any help on this would be appreciated. i know that generally most people use mysql with php but in this specific application it unfortunately has to be access. so i just need to be able to run SQL code against it.

    it does not seem to be working

    What does that meen? Are you getting any errors? Have you tried debugging your query so you can see any errors?

      thorpe wrote:

      What does that meen? Are you getting any errors? Have you tried debugging your query so you can see any errors?

      sorry i should have posted the error message. here it is:

      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 C:\movieListSite\backend\editmovie2.php on line 41
      Error in SQL

        ok i figured this one out - i had to give write access to the access database to the iusr_machineName user. now it works.

          Write a Reply...