Citation :
?php
$host="localhost";
$user="root";
$password="";
$nombd="trombi";
$db = mysql_connect($host, $user, $password);
mysql_select_db($nombd, $db);
$fich = "Etudiants.txt";
$fd=fopen ($fich, "r" );
$sql0="TRUNCATE TABLE `trombi`";
$req0=mysql_query ( $sql0 ) or die ('Erreur SQL !<br>'.$sql0.'<br>'.mysql_error()) ;
while ( !feof($fd) )
{
$res = fgets($fd,255);
list($numero, $nom, $prenom, $groupe, $sousgroupe) = split("\t",$res);
$req = "INSERT INTO trombi (numero,nom,prenom,groupe,sousgroupe) VALUES ('".$numero."','".$nom."','".$prenom."','".$groupe."','".$sousgroupe."')" ;
$req2 = mysql_query ( $req ) or die ('Erreur SQL !<br>'.$req.'<br>'.mysql_error()) ;
}
fclose($fd) ;
?>
|