<?php $frow=0; $list = array_map("trim", file($filename)); $list = array_map( create_function('$line', 'return split(",", $line);'), $list); $numrow=sizeof($list); for($r=1;$r<$numrow+1;$r++){ if($list[$r-1][6]){ $frow++; for($c=1;$c<8;$c++) $final[$frow-1][$c-1]=$list[$r-1][$c-1]; } } $file="c:\\a.csv"; if(file_exists($file)) if(!fopen($file, 'w+')) echo "k1"; $handle = fopen($file, 'w+'); $a="as"; if(!fwrite($handle, $a)) echo "bad"; fclose($handle); ?> this code doesn`t open the file even when the file exists what could be the problem
thanx itranna and jitesh for taking intrest. The files open when fopen($file, 'r'); is written now i want to open a file and write in it
Now place a file in same directory where you have placed ur script file. then try to open a file in write mode If It will open then you will understand what the matter is.