Is file_get_contents multi line?

Posted by Abs on Stack Overflow See other posts from Stack Overflow or by Abs
Published on 2010-04-22T14:22:19Z Indexed on 2010/04/22 14:23 UTC
Read the original article Hit count: 197

Filed under:
|
|

Hello all,

Does file_get_contents maintain line breaks? I thought it did but I have tried this:

if($conn){

    $tsql = file_get_contents('scripts/CreateTables/SLR05_MATCH_CREATETABLES.sql');

    $row = sqlsrv_query($conn, $tsql);

    print_r(sqlsrv_errors());

}

The errors I get is that SQL Server complains that there is incorrect syntax. I get the same errors when I run the SQL Script without any line breaks, which suggests file_get_contents removes them?

When I run the script normally (open the file in SQL Server Management Studio) and execute it, it works perfectly.

So is there something that I can use that maintains line breaks etc? Or is there another problem here in using queries from a file with the SQL Server PHP Driver from Microsoft?

Thanks all for any help

© Stack Overflow or respective owner

Related posts about php

Related posts about sql-server