Citation :
<?
require("conf.php3" );
// connection a la base en local $connect = mysql_connect($serveur,$user,$passwd);
if (!$connect) echo "erreur connection";
// selection de la base
$selection=mysql_select_db($bdd,$connect);
if (!$selection) echo "erreur selection base";
// votre requete de création de la table
//$create_table = "CREATE TABLE kart2 (
//id_eleve INT(11) NOT NULL AUTO_INCREMENT,
//nom_eleve VARCHAR(50) NOT NULL DEFAULT '',
//prenom_eleve VARCHAR(50) NOT NULL DEFAULT '',
//niveau_kart TINYINT(UNSIGNED) NOT NULL DEFAULT '',
//niveau_moto TINYINT(UNSIGNED) NOT NULL DEFAULT '',
//nbre_sessions_kart TINYINT(UNSIGNED) NOT NULL DEFAULT '',
//nbre_sessions_moto TINYINT(UNSIGNED) NOT NULL DEFAULT '',
//possede_voiture VARCHAR(3) NOT NULL DEFAULT '',
//adresse_mail_eleve VARCHAR(50) NOT NULL DEFAULT '',
//PRIMARY KEY(id_eleve),
//INDEX(niveau_kart,niveau_moto)
//)";
//if (!$create_table) echo "erreur création table";
$sql="CREATE TABLE client (
idclient int(10) unsigned NOT NULL auto_increment,
nom varchar(64) NOT NULL default '',
prenom varchar(64) NOT NULL default '',
age int(2) unsigned NOT NULL default '',
ville varchar(64) NOT NULL defaut '',
PRIMARY KEY (idclient),
KEY nom (nom)
)";
if (!$sql) echo "erreur $sql";
$creation=mysql_query($sql);
if (!$creation) echo "erreur creation";
//$create=mysql_query($create_table,$connect);
//if (!$create) echo "erreur création 2";
echo "Création terminée";
// votre requete de selection
$sql = mysql_query("SELECT nom_eleve FROM kart2 WHERE id_eleve='0'" );
if (!$sql) echo "erreur requete de selection";
// fermeture de la connection
mysql_close($connect);
?>
|