I've gotten a really weird result crop up on my site, and I can't find any information on the web that it has been seen elsewhere. Given how weird this is, I guess it's probably a symptom of either a server-side setting, or something very subtle.
I have some code that builds a MySQL statement to retrieve some records. The subsequent HTML displays the results. No problem.
I then changed the statement to have a WHERE clause that reads:
"WHERE DATEDIFF(NOW(), POSTDATE) <= 2"
Suddenly, I'm getting fragments of the php code behind the site turning up as output to the web page. There are no echo statements in this code at the points where the code is turning up, always as partial lines of the whole.
If I take the where clause back out, the code fragments do not appear.
At first I thought maybe my syntax was incorrect, that I had not closed off a line or php section, but its all the same as when the statement is not there. And the code does turn up from sections not in the same part as the SQL statement too.
I then tried putting in a number of echo statements to output at what stage in the code it had gotten too, along with an 'echo mysql_error()' statement to see if there was a problem with the SQL.
None of the echo statements got output, and the code fragments became larger portions of the code, which included the newly added echo statements right in the middle of them! So it's like this error is overriding what the echo command says, and even outputting content before, after, and during the line for the echo.
This is when the WHERE clause is in the statement. If I take the WHERE clause out, but leave the echo lines in, the problem continues to occur. It's only if I take both the echo statements and the WHERE clause out that it stops doing this.
This strikes me as very odd, and I wondered if anybody knows what might be causing this?