Ciao dinuovo,
Uso un while per recuperare un file CSV e fare l'importazione dei dati nel DB quale:
Codice PHP:
while(!feof($arq))
for($i=0; $i<1; $i++){
if ($contenuto = fgets($arq)){
$ll++;
$linea = explode(';', $contenuto);
}
$sql_cns = mysql_query("SELECT email FROM $tabella WHERE email = '".$linea[2]."'")
or die (mysql_error());
$row_cns = mysql_num_rows($sql_cns);
if($row_cns == 0){
mysql_query("INSERT INTO $tabella (nome, email) VALUES ('$linea[1]', '$linea[2]')")
//or die (mysql_error());
or die (mysql_error());
else{
mysql_query("UPDATE $tabella SET nome='".$linea[1]."'WHERE email = '".$linea[2]."'")
or die (mysql_error());
}
$linha = array();
Ora dovrei mostrare a video il resultato di tutto il processo per avere:
- Totale Linee:
- Totale Records Aggiunti:
- Totale Records Aggiornati:
- Totale Records Ignorati:
Come potrei implementarlo?
Grazie