<?php

	session_start();
	
	$_SESSION['database']="local";
	
	if($_SESSION['database']=="local")
	  {
	     $db_host    = "localhost";
	     $db_user   = "root";
	     $db_pass   = "";
     	     $db_name   = "boutique";

	 }
	
	if($_SESSION['database']=="public")
	  {
  	     $db_host    = "sql2";
   	     $db_user   = "analogde";
 	     $db_pass   = "rainbow";
    	     //$db_type   = "mysql";
	     $db_name   = "analogde";
	 }
	 
	 $nouvelle_categorie ="coco";
	 
	 $connexion = mysql_connect($db_host,$db_user,$db_pass); 
	 	mysql_select_db($db_name, $connexion);
	 
	 $p1= " CREATE TABLE $nouvelle_categorie (
  		 id tinyint(4) unsigned NOT NULL AUTO_INCREMENT,
  		 marque varchar(20) NOT NULL,
  		 id_catalogue varchar(20) NOT NULL,
  		 fournisseur varchar(20) NOT NULL,
  		 modele varchar(20) NOT NULL, "; 
  		 
	 $p2 = " un varchar(20) NOT NULL,";
  	 $p3 = " deux varchar(20) NOT NULL,";
  	 $p4 = " trois varchar(20) NOT NULL,";
  		 
  		 
  	 $plast = " PRIMARY KEY (id) ) ";
	       
         $requete = $p1 .$p2 .$p3 .$p4 .$plast; 	       
	       
	 mysql_query($requete);
	 
	  $tableau[]= "un";
	  $tableau[]= "deux";
	  $tableau[]= "trois";
	  $tableau[]= "quatre";
	  
	 
	 for($i=0; $i<=count($tableau)-1; $i++)
	           {  
	           	if($i == 0)
	           	  {$chaine = $tableau[$i] ." varchar(30) NOT NULL,";
			  }
			if($i != 0)
			  {$chaine = $chaine ." " .$tableau[$i] ." varchar(30) NOT NULL,";
			  }
			
	           }
	           
	           echo $chaine;
	           
	           //print_r($tableau);
	 
	 
?>	 