I am using the fwrite() function in PHP to create a csv file. It connects to a database and retrieves two columns from a table. I can get this to work, however it only writes the first row. For example..
+------+-----+--+--+--+
| John | Doe | | | |
+------+-----+--+--+--+
| | | | | |
+------+-----+--+--+--+
| | | | | |
+------+-----+--+--+--+
How do i get it to go onto the next line and write the next row, and keep on writing how ever many rows there are in the table. For example..
+---------+-----+--+--+--+
| John | Doe | | | |
+---------+-----+--+--+--+
| Jane | Doe | | | |
+---------+-----+--+--+--+
| Richard | Doe | | | |
+---------+-----+--+--+--+
| | | | | |
+---------+-----+--+--+--+
Here is my PHP code
fwrite($file, ucfirst($row['name']) . ', ' . ucfirst($row['visiting']));