Help please, database queries not working

skypanther

Exalted Code Master!
A client's site is acting all funky and I don't see what's causing the error. Perhaps you can give me your thoughts on how to troubleshoot it? Check out:

http://renewableenergylongisland.org/pressRelease.cfm

Click the first press release entry and you get an empty page. Click on the second one and you get data. Both use the same code and simply pull data from a mysql database. So, I know the CF code is working.

I can use phpmyadmin and look at my database, and there's data in all the records. It's as if the query is retrieving an empty record but it's a bit weirder than that.

I created a test version of the page that outputs the db query as well as the number of records returned. For records IDs that I know exist and that I know have data in them, I get "Records retrieved: 0" from my test code.

http://renewableenergylongisland.org/test_pr.cfm?releaseID=65

I have the query wrapped in a <cftry> block yet the <cfcatch type="database"> and "<cfcatch type="any"> blocks aren't getting called.

I don't do a whole lot of CF anymore (I mostly do PHP) so I'm really rusty. What are some debugging methods I can use to figure out what's causing this?

Thanks,
Tim

PS - This is a site, that until this past weekend, was hosted elsewhere. I just moved it here. It was working fine there. I exported my DB from the other host and imported it here (a couple of times now). Since most of the pages work and just a few database-related issues like this are coming up, I don't think it's a major imcompatibility between environments.
 
Too weird...

I put in a ticket to have the DSN deleted and re-created. That did nothing to solve the problems. So, I went back to fiddling with the database.

I found that by deleting the contents of the longtext field in the troublesome record, the query would find the record and display all the other fields' contents.

Given that a longtext field should support 2^32 characters, the length of data shouldn't matter (none of my records were anywhere near that limit). Just the same, I tried entering a smaller block of data in one of the troublesome records. I found that as long as I entered less than 4106 characters, the record would be found by the query and displayed on the page.

I was doing that by copying and pasting from a local copy of the database. So, I tried typing in the remainder of the data in small pieces by hand, thinking that there was some special character or whatever messing up the database. I found nothing like that. But, I did find that if entered one word at a time, then saved the data to the database here, that I could get all the data to show up.

What's enormously weird is that I did this for one record. But after doing so, the dozen or so other records that were giving me troubles all show up now, even though I didn't make any changes to their data.

This just feels like a ticking time-bomb, like whatever caused it to fail before is going to come back later. But at least for now the site's working and I can go back to doing other (paying) jobs.

Tim
 
Back
Top