Action queries not acting

admin

Administrator
Staff member
Hi,
As a bit of a novice I am stuck with a little problem. I am using MS Access as
my datasource (I know - part of my problem right off the bat) and I have been
successful in communications with php3 and access through an odbc connection.

My problem is this (using the following code), the $conn is
</pre>
$conn=0;
$conn = odbc_pconnect("phptestdsn", "","" ); //this works fine
$sqlstr = "INSERT INTO tblHeads (inprogress) ";
$sqlstr = $sqlstr . "VALUES ('true');";

if ($result = odbc_exec($conn, $sqlstr))
{
//Get the new headid
$sqlstr2 = "SELECT tblHeads.HeadID, tblHeads.inprogress FROM tblHeads WHERE (((tblHeads.inprogress)='true'));";
if ($result2 = odbc_exec($conn, $sqlstr2))
{
if (odbc_fetch_row($result2))
{
$myheadid = odbc_result($result2,"HeadID");
echo "my head id: " . $myheadid. "<br>";
}
}
}</pre>
The problem is that although the INSERT INTO statement is setting the 'inprogress' field to 'true', and a new record does get created, the next sql involving that table does not seem to 'see' the new record. When I open the table in Access, the new record is there. If I do a subsequent query elsewhere on the page, the record will appear.

My question is whether or not I can nest the next call to the same table as I have done or does this cause some sort of mis-communication between php and the odbc driver?

Welcoming any input,
Aaron M.
 
Back
Top