par
Xenon_54 » 12 janv. 2007, 00:35
Tu peux utiliser cette requête pour récupérer les champs d'une table:
Code : Tout sélectionner
mysql> SHOW FULL FIELDS FROM news_com;
+-------+---------+-------------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+---------+-------------------+------+-----+---------+----------------+---------------------------------+---------+
| id | int(6) | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| date | int(10) | NULL | NO | | 0 | | select,insert,update,references | |
| news | int(6) | NULL | NO | | 0 | | select,insert,update,references | |
| user | int(6) | NULL | NO | | 0 | | select,insert,update,references | |
| texte | text | latin1_general_ci | NO | | | | select,insert,update,references | |
+-------+---------+-------------------+------+-----+---------+----------------+---------------------------------+---------+
5 rows in set (0.00 sec)
Ensuite tu batis ta requête avec le résultat.
Tu peux utiliser cette requête pour récupérer les champs d'une table:
[code]mysql> SHOW FULL FIELDS FROM news_com;
+-------+---------+-------------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+---------+-------------------+------+-----+---------+----------------+---------------------------------+---------+
| id | int(6) | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| date | int(10) | NULL | NO | | 0 | | select,insert,update,references | |
| news | int(6) | NULL | NO | | 0 | | select,insert,update,references | |
| user | int(6) | NULL | NO | | 0 | | select,insert,update,references | |
| texte | text | latin1_general_ci | NO | | | | select,insert,update,references | |
+-------+---------+-------------------+------+-----+---------+----------------+---------------------------------+---------+
5 rows in set (0.00 sec)[/code]
Ensuite tu batis ta requête avec le résultat.