Hello,

I'm accessing DBASE files (*.dbf) through the ODBC API
of a PHP 4.6.0 module.

I can select information, I can insert information
but I can not delete neither update.

Here is my code and the associated error messages :

$connect_odbc=odbc_connect($Host,"","",SQL_CUR_USE_ODBC) or die("Erreur de connexion 
au serveur");
    if (!odbc_autocommit($connect_odbc, TRUE)) {
        echo 'pb auto_commit';
        return;
    }
    // selection avant
    $Req_hebd = "select * from fichhebd where NOSAL=$Nosal and NOSEM=$Nosem and 
ANNEE=".substr($Annee,2,2);
    echo $Req_hebd .'<br>';

    if (!($Res_hebd=odbc_prepare($connect_odbc,$Req_hebd))) {
        echo 'pb prepare';
    }
    if (!odbc_execute($Res_hebd)) {
        echo 'pb execute';
    }
    if (!($res=odbc_result_all($Res_hebd))) {
        echo 'pb result_all';
    }
-----
all is OK : the following lines appear :
      NOSAL NOSEM ANNEE IDRUBRIQUE IDCONTRAT NBMINUTE 
      22.0 43.0 1.0 RD 593 1230.0 
      22.0 43.0 1.0 RD 593 2.0 

---- 
    echo "<br>res:" . $res;
    odbc_free_result($Res_hebd);
    
    // essai sur update
    $Req_hebd="UPDATE fichhebd set NBMINUTE=0 WHERE NOSAL=$Nosal and NOSEM=$Nosem and 
ANNEE=".substr($Annee,2,2);
    echo $Req_hebd .'<br>';
    $Res_hebd = odbc_exec($connect_odbc,$Req_hebd);
---- 
PB : the following lines appear :
Warning: SQL error: [Microsoft][Pilote ODBC dBase] L'opération doit utiliser une 
requête qui peut être mise à jour., SQL state S1000 in SQLExecDirect in 
C:\Inetpub\wwwroot\CRA\Normal\valider.php on line 140
NB : 'L'opération doit utiliser une requête qui peut être mise à jour' means 'it is 
not possible to make au update request'.
----
    echo 'num_row:' . odbc_num_rows($Res_hebd) .'<br>';
    odbc_free_result($Res_hebd);
    
    $Req_hebd="DELETE FROM fichhebd WHERE NOSAL=$Nosal and NOSEM=$Nosem and 
ANNEE=".substr($Annee,2,2);
    echo $Req_hebd .'<br>';
    $Res_hebd = odbc_exec($connect_odbc,$Req_hebd);
---- 
PB : the following lines appear :
Warning: SQL error: [Microsoft][Pilote ODBC dBase] Impossible de supprimer dans les 
tables spécifiées., SQL state S1000 in SQLExecDirect in 
C:\Inetpub\wwwroot\CRA\Normal\valider.php on line 146
NB : ' Impossible de supprimer dans les tables spécifiées' means 'It is not possible 
to suppress in the specified tables'.
----

    echo 'num_row:' . odbc_num_rows($Res_hebd) .'<br>';
    odbc_free_result($Res_hebd);

// end of the php script

Thank you for helping me.

Best regards.
-------------------------------
Christine CAMELI
ELIOS Informatique
Tél : 02 96 48 51 51

Reply via email to