Aller, je t'aide un peu :
function liste_tables() { include("variables.php"); $retour=array(); $requete = "SHOW TABLES "; $resultat=mysql_db_query(SQL_BASE,$requete,$bp); $i=0; while($tmp=mysql_fetch_array($resultat)) { $retour[$i]=$tmp[0]; $i++; } return $retour; } function liste_champs($table) { include("variables.php"); $retour=array(); $requete = "SHOW COLUMNS FROM `$table` "; $resultat=mysql_db_query(SQL_BASE,$requete,$bp); $i=0; while($tmp=mysql_fetch_array($resultat)) { $retour[$i]=$tmp[0]; $i++; } return $retour; }
le fichier "variables .php" : define("SQL_SERVEUR","localhost"); define("SQL_LOGIN","monogin"); define("SQL_MDP","monmotdepasse"); define("SQL_BASE","mabasededonnees"); $bp=mysql_connect(SQL_SERVEUR,SQL_LOGIN,SQL_MDP);
|