I am pulling results from a mysql DB and trying to write a new line to the same file for each result. Here's the code:
$sql="SELECT results FROM table";
$runQuery=mysql_query($sql);
$resultRows=mysql_num_rows($runQuery);
while($getResults = mysql_fetch_array($runQuery)){
for($i=0; $resultRows>=$i; $i++){
$lineName=$getResults["sqlFieldName"];
fopen("dir/$varFileName" . ".txt", "w+");
if ($file=fopen("dir/$varFileName" . ".txt", "w+")){
fputs($file, "http://location/$lineName\n");
}
}
fclose($file);
I suspect my loops aren't being used properly, or in the right order?
Any help is appreciated.