Salut,
J'ai un problème pour incrémenter un champ. Enfin voila le code:
Mais voila, je sais que la syntaxe champ + 1 fonctionne, mais dans ce cas, il m'insère b + 1 dans la table au lieu de 101 si j'ai 100 au départ
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 /* $table = 'table'; $champ = 'b'; $where = "id='1'"; */ function increment($table, $champ, $where) { $this->query = @mysql_query("UPDATE ".$table." SET ".$champ."='".$champ." + 1' WHERE ".$where, $this->link) or die (mysql_error()); }
Partager