Jump to content

[SOLVED] PHP and Insert into Access Problem


rich11

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.