Hello all,
I have what I thought would be simple issue to reslove but I have been struggling with it all morning and I'm hoping someone can help me.
I have a class that manipulates data. The class takes an SQL statement as a part of its constructor. The problem is that I heavily format my SQL (see below) to make it easier to read in code. If I remove all the carriage returns and tabs from the string ($sql) the class works fine. If I don't it fouls up the $sql. the class parses the SQL and does a lot of manipulations - the tabs and/or carriage returns are not properly recognized or ignored
I'd like to change the constructor to strip out the carriage returns and/or tabs in string. But I'll be d*mned if I can figure out how? Is there a string command to do this?
If I use <b>str_replace()</b> What string(s) is the $needle?
Thanks in advance... a star awaits you!
-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!
I have what I thought would be simple issue to reslove but I have been struggling with it all morning and I'm hoping someone can help me.

I have a class that manipulates data. The class takes an SQL statement as a part of its constructor. The problem is that I heavily format my SQL (see below) to make it easier to read in code. If I remove all the carriage returns and tabs from the string ($sql) the class works fine. If I don't it fouls up the $sql. the class parses the SQL and does a lot of manipulations - the tabs and/or carriage returns are not properly recognized or ignored
I'd like to change the constructor to strip out the carriage returns and/or tabs in string. But I'll be d*mned if I can figure out how? Is there a string command to do this?
If I use <b>str_replace()</b> What string(s) is the $needle?
Code:
$sql = '
SELECT
CONCAT(LTRIM(RTRIM(firstname))," ", LTRIM(RTRIM(lastname)),) as Name,
YEAR(CURRENT_DATE) - YEAR(DOB) AS Age,
ID AS Commands
FROM '.$catalog.'
WHERE INSTR("'.$filterCatalog.'",UPPER(LEFT(LASTNAME,1)))>0
AND DOB!="0000-00-00"
AND RIP ="0000-00-00"
ORDER BY lastname, firstname ';
Thanks in advance... a star awaits you!
-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!