I am trying to write a csv file. Seems to work fine except I don't get a carriage return. So, when I import the file into Excel, it's one long string. Here is the code I use:
$line = $StudentLogin . ',' . $Enrolled . ',';
$fout = fwrite($f_stu, $line);

Obviously, the "comma" at the end is not the answer. So, what is?

The other problem I have is that I need to check a field from MySql db to see if it is a "null". I know this is not a php issue but I was hoping somebody could help me on this. My code:
$query = "SELECT *
FROM students
WHERE S_Enrolled < '$AR_Date'
OR S_Enrolled = '????????'
";

Where I have the ???? I need to check for null values.

    I tried \n. And that is exactly what I got. Avalue of "\n". Unless of course it should not be in quotes?

      double quotes or your just using the string representation.

        IS NULL is working well. Thanks a zillon (that's more than a million🙂)

          When I use the code: $line = $StudentLogin . ',' . $Enrolled . \n;

          I get
          date----LoginID-------- date----LoginID----------etc. etc. etc.
          080710n4118KH221Ir,080711n4118KB221OK,080711n4079JB223Zx,080713n3612TC223vH,

          When I use: $line = $StudentLogin . ',' . $Enrolled . "\n"; I get the same result. No line break in Notepad

            When I use: $line = $StudentLogin . ',' . $Enrolled . '\r\n';

            I get:
            4118AS231tq,080721\r\n3612KC232UI,080722\r\n3612DA232Jd,080722\r\nholguin,080722\r\n

            When I use: $line = $StudentLogin . ',' . $Enrolled . "\r\n"; it works using double quotes!

              Write a Reply...