Need to count updated data in the table, but $up stays 0. Data received from imported csv file.
$up=0;
do { //loop through the csv file
if ($data[0]) {
$res = mysql_query("SELECT ...");
$check=false;
for($i = 0; $array[$i] = mysql_fetch_assoc($res); $i++){
while ((condition)){
$check = true;
$i++;
};
};
if ($check) {
$up++;//this does not work
mysql_query("UPDATE ...");
}
else {
mysql_query("INSERT ...");
}
}
} while ($data = fgetcsv($handle,1000,",","'"));
there's code below do-while loop where I choose the file and get the messege about $up
<html>
...
<?php if (!empty($_GET[success])) {echo $up; } ?>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
Choose your file: <br />
<input name="csv" type="file" id="csv" />
<input type="submit" name="Submit" value="Submit" />
</form>
...