Ask a Question related to Coldfusion Database Access, Design and Development.
-
ztom27 #1
Very odd, page output going into sql statement
Hi,
I have completely failed to come up with an explanation for this one. I have
a sql statement near the top of my page. The SQL is well-formed. About one
out of every 1000-2000 page views, I get this error in my logs:
Syntax error or access violation: You have an error in your SQL syntax near
'<html><head>'
But the <html><head> part of my page is 100 lines below the sql statement, so
I have no idea what it's doing in my sql statement. Somehow the page output is
getting mixed up and finding its way into my sql statement.
I repeat it's not a problem with the cfquery (at least not an obvious one),
because it works almost every time. Some further details:
Latest version of MX
Mysql 3
Linux
Using cfqueryparam
This happens in various queries on various pages, it seems random, however as
far as I can tell it ONLY happens when I implement onRequest in my
Application.cfc.
Any ideas for a workaround or fix would be much appreciated. (Removing
onRequest will be my last resort but it's legacy code so I'd rather not).
ztom27 Guest
-
Output from different datasource in cfquery statement
i've make 2 cfquery statements. one refers to datasource DatStudent and another one refers to datasource DatModul. in coldfusion admin, DatStudent... -
Repeating output with cfif statement
I have a problem when multiple checkboxes are "turned on' when multiple values exist for a field in a database. For example: The following code... -
Getting page output
Is there a tag or method I can use to grab the page output so that I can amend it prior to outputting. -
SQL statement working in SQL Server but not in .aspx.cs page
I have written the following query with a subquery to add a counter to be added to a drop down list, which works in SQL Server, but when I transfer... -
Calling a html page from an asp page then returning to the next statement on the original asp page
Hi! I have an ASP page that calls excel to create a report. This works fine. Now I need to call a html calendar page to filter what rows are... -
Dan Bracuk #2
Re: Very odd, page output going into sql statement
Does this query use any url, form, sesssion, etc variables? Unexpected values
with those are often the source of intermittent problems.
You could always wrap the query with cftry, and mail yourself some cfcatch
details to help you figure it out.
Dan Bracuk Guest
-
ztom27 #3
Re: Very odd, page output going into sql statement
Thanks for your response. It does use a url variable, but it's the same every
time and it's validated to be an integer. I think this problem has something
specifically to do with using onRequest because it never happened before. My
error page saves all the cfcatch info -- here's an example of what I find in my
exception.rootCause.sql in the error log:
select items.name from items where itemID = (param 1) and deletedflag = 0
<base href=" and paiduntil >= {ts '2006-04-08 12:22:17'}
The code causing this looks like:
<cfquery name="myquery" datasource="#request.dsn#">
select items.name from items
where
itemID = <cfqueryparam cfSQLtype="CF_SQL_INTEGER" value="#itemid#">
and deletedflag = 0
and paiduntil >= #CreateODBCDateTime(now())#
</cfquery>
(#itemID# is the url parameter)
Obviously the error is caused by the html code "base href" getting into my sql
statement, the problem is I didn't put it there. The "base href" code is a
hundred lines below the cfquery and is somehow sticking itself in the middle of
my query.
ztom27 Guest
-
ztom27 #4
Re: Very odd, page output going into sql statement
The plot thickens....
It's not just sql statements. I just saw the "<html><head><base href=..."
code show up at the top of a page that didn't have any sql or even any html
tags. The only code in the file is:
<cfset tracker = createObject("java","coldfusion.runtime.SessionTra cker")>
<cfoutput><p>There are #tracker.getSessionCount()# active
sessions</p></cfoutput>
It happened a couple times, now I can't get it to repeat itself.
ztom27 Guest



Reply With Quote

