Hi,
I've got some code that takes an sql query and writes it to a text file. My only issue is that I need to make sure that in the text file each sql query is on a separate line, however I cannot seem to achieve this.
Currently my code is as follows:
$sql = "UPDATE CustomerCRAssociation SET Resolved = 1 WHERE id = $v";
$result = odbc_exec($con2,$sql);
// update test file
$filename = "../CV/General Files/Cust_Association_Update.txt";
$newfile = @fopen($filename, "a+") or die("Couldn't open file.");
@fwrite($newfile, $sql) or die("Couldn't write to file.");
fclose($newfile);
I thought it would just be a case of adding some sort of line break to the code, but I cannot get anything to work. Any assistance would be hugely appreciated.
Cheers.