I designed a php file which will read data from a txt file and insert it into mysql but i want after inserting the data into mysql delete everything inside of the txt file is that possible? if it is how?
my php file is like this
<?
@mysql_connect("localhost", "Dakkar", "")
or die("Veritabani ile baglanti kurulamadi!");
@mysql_select_db("uopvp")
or die("Veritabaninda bir hata olustu!");
$lines = file("pvp.txt");
$i=0;
foreach ($lines as $line_num => $line) {
$i++;
}
for ($x=0;$x<$i;$x++) {
list($account, $name, $puan, $kills, $guild) = explode(" ",$lines[$x]);
$sql = "SELECT count(*) FROM pvp WHERE account='$account' and name='$name' ";
$res = mysql_query($sql) OR die(mysql_error());
$row = mysql_fetch_row($res);
if($row[0] == 0) {
@mysql_query("insert into pvp values('','$account','$name','$puan','$guild','$kills','')");
echo "<center><b>Veriler Kaydedildi.Tesekkurler.</b></center>";
}
else {
mysql_query("UPDATE pvp SET puan='$puan' WHERE account='$account' and name='$name'");
mysql_query("UPDATE pvp SET guild='$guild' WHERE account='$account' and name='$name'");
mysql_query("UPDATE pvp SET kills='$kills' WHERE account='$account' and name='$name'");
echo "<center><b>Veriler Guncellendi.Tesekkurler.</b></center>";
}
}
// I want to add the deleting line here
?>