Comment savoir si un UPDATE (mysql) a bien fonctionné ?
2 réponses
Superman
Bonjour,
Voici mon code :
Dim pMySQL As Long
dim test as integer
dim Identifiant as string
dim newmdp as string
Identifiant =3D "mathieu"
newmdp =3D "test"
pMySQL =3D mysql_init(0)
If mysql_real_connect(pMySQL, "localhost", "root", "",
"gestion_droit", 0, "", 0) =3D 0 Then
MsgBox "la connexion a la base de donn=E9es a =E9chou=E9e"
Exit Sub
End If
test =3D mysql_query(pMySQL, "UPDATE gestion SET mdp =3D '" & newmdp & "'
WHERE Identifiant =3D '" & identif & "'")
mysql_close (pMySQL)
Le probleme c'est que je n'ai sais pas si le UPDATE a =E9t=E9 fait
correctement (j'ai essay=E9 d'afficher la varible test mais quoi qu'il
arrive, j'obtiens toujours "0")
Comment savoir si le UPDATE c'est fait correctement ?
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
jean-marc
> "Superman" wrote in message news: Bonjour,
Voici mon code :
Dim pMySQL As Long dim test as integer dim Identifiant as string dim newmdp as string
Identifiant = "mathieu" newmdp = "test"
pMySQL = mysql_init(0)
If mysql_real_connect(pMySQL, "localhost", "root", "", "gestion_droit", 0, "", 0) = 0 Then MsgBox "la connexion a la base de données a échouée" Exit Sub End If
test = mysql_query(pMySQL, "UPDATE gestion SET mdp = '" & newmdp & "' WHERE Identifiant = '" & identif & "'")
mysql_close (pMySQL)
Le probleme c'est que je n'ai sais pas si le UPDATE a été fait correctement (j'ai essayé d'afficher la varible test mais quoi qu'il arrive, j'obtiens toujours "0")
Comment savoir si le UPDATE c'est fait correctement ?
Merci Superman !
Hello,
comme dans toutes les DB, il y a une fonction qui permet de connaitre le nombre de rows affectées par un statement.
> "Superman" <john.ambou@free.fr> wrote in message
news:1185876021.701912.66220@o61g2000hsh.googlegroups.com...
Bonjour,
Voici mon code :
Dim pMySQL As Long
dim test as integer
dim Identifiant as string
dim newmdp as string
Identifiant = "mathieu"
newmdp = "test"
pMySQL = mysql_init(0)
If mysql_real_connect(pMySQL, "localhost", "root", "",
"gestion_droit", 0, "", 0) = 0 Then
MsgBox "la connexion a la base de données a échouée"
Exit Sub
End If
test = mysql_query(pMySQL, "UPDATE gestion SET mdp = '" & newmdp & "'
WHERE Identifiant = '" & identif & "'")
mysql_close (pMySQL)
Le probleme c'est que je n'ai sais pas si le UPDATE a été fait
correctement (j'ai essayé d'afficher la varible test mais quoi qu'il
arrive, j'obtiens toujours "0")
Comment savoir si le UPDATE c'est fait correctement ?
Merci
Superman !
Hello,
comme dans toutes les DB, il y a une fonction qui permet
de connaitre le nombre de rows affectées par un statement.
Pour mysql, la syntaxe est décrite ici:
http://be.php.net/function.mysql-affected-rows
Dim pMySQL As Long dim test as integer dim Identifiant as string dim newmdp as string
Identifiant = "mathieu" newmdp = "test"
pMySQL = mysql_init(0)
If mysql_real_connect(pMySQL, "localhost", "root", "", "gestion_droit", 0, "", 0) = 0 Then MsgBox "la connexion a la base de données a échouée" Exit Sub End If
test = mysql_query(pMySQL, "UPDATE gestion SET mdp = '" & newmdp & "' WHERE Identifiant = '" & identif & "'")
mysql_close (pMySQL)
Le probleme c'est que je n'ai sais pas si le UPDATE a été fait correctement (j'ai essayé d'afficher la varible test mais quoi qu'il arrive, j'obtiens toujours "0")
Comment savoir si le UPDATE c'est fait correctement ?
Merci Superman !
Hello,
comme dans toutes les DB, il y a une fonction qui permet de connaitre le nombre de rows affectées par un statement.