Entrer valeur d'une variable dans BDD
Fermé
glagla
-
5 janv. 2012 à 17:58
ferranzo Messages postés 27 Date d'inscription dimanche 30 novembre 2008 Statut Membre Dernière intervention 8 janvier 2012 - 7 janv. 2012 à 22:51
ferranzo Messages postés 27 Date d'inscription dimanche 30 novembre 2008 Statut Membre Dernière intervention 8 janvier 2012 - 7 janv. 2012 à 22:51
A voir également:
- Entrer valeur d'une variable dans BDD
- Rechercher ou entrer l'adresse - Guide
- Entrer les informations d'identification reseau - Guide
- Adresse IP locale : comment la trouver facilement - Guide
- Entrer coordonnées gps google maps - Guide
- Logiciel gratuit calcul valeur nutritionnelle - Télécharger - Santé & Bien-être
3 réponses
Autumn`Tears
Messages postés
1054
Date d'inscription
samedi 14 mars 2009
Statut
Membre
Dernière intervention
23 octobre 2013
145
5 janv. 2012 à 18:02
5 janv. 2012 à 18:02
Salut,
Tu peux quand même faire ça : "insert into (champ,nomdejeunefille,champ) values ('".$val1."','".$_POST['nomdejeunefille']."','".$val2."')";
Ça ne devrait pas poser de problème, mais il doit falloir avoir dans ta base le champ à DEFAULT NULL. (à vérifier)
Tu peux quand même faire ça : "insert into (champ,nomdejeunefille,champ) values ('".$val1."','".$_POST['nomdejeunefille']."','".$val2."')";
Ça ne devrait pas poser de problème, mais il doit falloir avoir dans ta base le champ à DEFAULT NULL. (à vérifier)
jisisv
Messages postés
3645
Date d'inscription
dimanche 18 mars 2001
Statut
Modérateur
Dernière intervention
15 janvier 2017
934
Modifié par jisisv le 5/01/2012 à 18:14
Modifié par jisisv le 5/01/2012 à 18:14
Utilise la clause UPDATE.
exemple sous MySQL:
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
exemple sous MySQL:
mysql> select * from random2 where date1='2012/01/03'; +------------+-------+ | date1 | date2 | +------------+-------+ | 2012-01-03 | NULL | +------------+-------+ 1 row in set (0.00 sec) mysql> update random2 set date2='1970/01/01' ; Query OK, 201 rows affected (0.00 sec) Rows matched: 201 Changed: 201 Warnings: 0 mysql> select * from random2 where date1='2012/01/03'; +------------+------------+ | date1 | date2 | +------------+------------+ | 2012-01-03 | 1970-01-01 | +------------+------------+ 1 row in set (0.00 sec) mysql> help update;; Name: 'UPDATE' Description: Syntax: Single-table syntax: UPDATE [LOW_PRIORITY] [IGNORE] table_reference SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ... [WHERE where_condition] [ORDER BY ...] [LIMIT row_count] Multiple-table syntax: UPDATE [LOW_PRIORITY] [IGNORE] table_references SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ... [WHERE where_condition] For the single-table syntax, the UPDATE statement updates columns of existing rows in the named table with new values. The SET clause indicates which columns to modify and the values they should be given. Each value can be given as an expression, or the keyword DEFAULT to set a column explicitly to its default value. The WHERE clause, if given, specifies the conditions that identify which rows to update. With no WHERE clause, all rows are updated. If the ORDER BY clause is specified, the rows are updated in the order that is specified. The LIMIT clause places a limit on the number of rows that can be updated. For the multiple-table syntax, UPDATE updates rows in each table named in table_references that satisfy the conditions. In this case, ORDER BY and LIMIT cannot be used. where_condition is an expression that evaluates to true for each row to be updated. For expression syntax, see https://dev.mysql.com/doc/refman/8.0/en/expressions.html table_references and where_condition are is specified as described in https://dev.mysql.com/doc/refman/8.0/en/select.html You need the UPDATE privilege only for columns referenced in an UPDATE that are actually updated. You need only the SELECT privilege for any columns that are read but not modified. The UPDATE statement supports the following modifiers: o With the LOW_PRIORITY keyword, execution of the UPDATE is delayed until no other clients are reading from the table. This affects only storage engines that use only table-level locking (such as MyISAM, MEMORY, and MERGE). o With the IGNORE keyword, the update statement does not abort even if errors occur during the update. Rows for which duplicate-key conflicts occur are not updated. Rows for which columns are updated to values that would cause data conversion errors are updated to the closest valid values instead. URL: https://dev.mysql.com/doc/refman/8.0/en/update.html
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
ferranzo
Messages postés
27
Date d'inscription
dimanche 30 novembre 2008
Statut
Membre
Dernière intervention
8 janvier 2012
7 janv. 2012 à 22:51
7 janv. 2012 à 22:51
UPDATE user set nomdejeunefille='une valeur' where id=idDelaPersonne