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";

}

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

 

 

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.

Archived

This topic is now archived and is closed to further replies.

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