Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
961 connectés 

  FORUM HardWare.fr
  Programmation
  SQL/NoSQL

  [MySQL (PHP)] empêcher un NOW sur un champ quand on update un enregist

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[MySQL (PHP)] empêcher un NOW sur un champ quand on update un enregist

n°437052
Deadog
Dain Bramaged
Posté le 23-06-2003 à 16:50:03  profilanswer
 

voila, j'ai le champ d'une de mes tables MySQL ki à l'attribut NOW
à chaque fois ke j'update un enregistrement de cette table, le champ concerné par le NOW s'update à chaque fois :(
 
comment faire pour l'empêcher s'updater ? (en php, m'enfin, ça a pas d'importance ça, je pense ke ça concerne ke la requête SQL)
c possible avec phpMyAdmin [:spamafote]
(je précise ke je peux pas enlever l'attribut now du champ)

mood
Publicité
Posté le 23-06-2003 à 16:50:03  profilanswer
 

n°437054
RiderCrazy
Posté le 23-06-2003 à 16:51:39  profilanswer
 

deadog a écrit :

voila, j'ai le champ d'une de mes tables MySQL ki à l'attribut NOW
à chaque fois ke j'update un enregistrement de cette table, le champ concerné par le NOW s'update à chaque fois :(
 
comment faire pour l'empêcher s'updater ? (en php, m'enfin, ça a pas d'importance ça, je pense ke ça concerne ke la requête SQL)
c possible avec phpMyAdmin [:spamafote]
(je précise ke je peux pas enlever l'attribut now du champ)

Pourquoi ??

n°437056
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 23-06-2003 à 16:52:02  profilanswer
 

J'me suis posé la même question ce matin [:ddr555]  
La réponse est dans la doc MySQL [:spamafote]
http://www.mysql.com/documentation [...] l#DATETIME

Citation :


Automatic updating of the first TIMESTAMP column occurs under any of the following conditions:  
 
The column is not specified explicitly in an INSERT or LOAD DATA INFILE statement.  
The column is not specified explicitly in an UPDATE statement and some other column changes value. (Note that an UPDATE that sets a column to the value it already has will not cause the TIMESTAMP column to be updated, because if you set a column to its current value, MySQL ignores the update for efficiency.)  
You explicitly set the TIMESTAMP column to NULL.  
TIMESTAMP columns other than the first may also be set to the current date and time. Just set the column to NULL or to NOW().  
 
You can set any TIMESTAMP column to a value different from the current date and time by setting it explicitly to the desired value.


 
EDIT : par contre, si t'as NOW() dans ton champ, je suis pas sûr que ça marche...


Message édité par Taiche le 23-06-2003 à 16:52:40

---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°437155
Deadog
Dain Bramaged
Posté le 23-06-2003 à 17:49:47  profilanswer
 

exact ! ça marche :)
 
merci :jap:  
 
rider > pke d'autres script du site s'en servent et ke l'heure des grands changements dans les scripts n'est pas encore venus ;)


Message édité par Deadog le 23-06-2003 à 17:51:50

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  SQL/NoSQL

  [MySQL (PHP)] empêcher un NOW sur un champ quand on update un enregist

 

Sujets relatifs
Problème avec les apostrophes en programmation Mysql[PHP] fetch_array ou fetch_object
Optimisation mysql[PHP] Comment gérer une chaîne avec des guillemets ??
Est ce que le PHP supporte les variables nommees ?petit problème avec une classe PHP
[OVH] Script PHP pour création de compte pop ???[PHP] Se connecter a un site securisé (https) et y recuperer une page
Existe t'il en C un fonction md5() comme en PHP[PHP] Passer un paramètre à une fonction
Plus de sujets relatifs à : [MySQL (PHP)] empêcher un NOW sur un champ quand on update un enregist


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR