Re: [PHP-DB] ODBC problem

2001-12-13 Thread Christine Cameli

Hello,

We resolved ourselves the problem by changing the ODBC driver.
Bye.
- Original Message -
From: Christine Cameli [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Katell Galard [EMAIL PROTECTED]
Sent: Tuesday, December 11, 2001 5:03 PM
Subject: [PHP-DB] ODBC problem


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 brres: . $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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] ODBC problem

2001-12-11 Thread Christine Cameli

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 brres: . $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