Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Comments not appearing due to SQL error?
I have three txp websites, all hosted by the same ISP. Two of them display comments without a hitch. The third never has displayed comments, only the comments form.
The comment forms are identical for all three sites; all three are set to append comments as a numbered list automatically to each article. Comments have been made to the problem site, and show up in the admin panel as visible.
When I run a tag trace, I get the following:
<txp:comments />
tag_error <txp:comments /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
select *, unix_timestamp(posted) as time from txp_discuss where parentid=321 and visible=1 order by
textpattern/lib/txplib_db.php:220 startrows() on line 82
[SQL (0.0001060962677): select *, unix_timestamp(posted) as time from txp_discuss where parentid=321 and visible=1 order by ]
I have no idea how the SQL syntax for the one site could be different than the other two. Any thoughts?
Offline
Re: Comments not appearing due to SQL error?
Sorry: that’s the tag trace that appears in the source code; here’s what appears at the top of the page itself in Debugging mode:
tag_error <txp:comments /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
select *, unix_timestamp(posted) as time from txp_discuss where parentid=321 and visible=1 order by
textpattern/lib/txplib_db.php:220 startrows() on line 82
textpattern/lib/txplib_db.php:82 trigger_error()
textpattern/lib/txplib_db.php:282 safe_query()
textpattern/lib/txplib_db.php:220 startrows()
textpattern/publish/taghandlers.php:1752 safe_rows_start()
textpattern/publish.php:1090 comments()
textpattern/publish.php:1012 processtags()
textpattern/lib/txplib_misc.php:1548 parse()
textpattern/publish.php:865 parse_form()
textpattern/publish.php:887 doarticle()
textpattern/publish.php:550 parsearticles()
Offline
Re: Comments not appearing due to SQL error?
Hmm, looking at the code for the <txp:comments />
tag (which appears to be the culprit here), the only situation under which I can see the ORDER BY being empty is if you’ve set sort=""
in the tag itself. Or some plugin is mangling the sort argument somehow.
Last edited by Bloke (2009-01-01 16:05:34)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Comments not appearing due to SQL error?
No plugins on this site at all.
comments_display is (I think) right out of the box:
<txp:comments />
<txp:if_comments_allowed>
<txp:comments_form />
<txp:else />
<p><txp:text item="comments_closed" /></p>
</txp:if_comments_allowed>
So no sort override there, either.
comments is as follows:
<txp:comment_message /><br />
<small>— <txp:comment_name />    <txp:comment_time />    <txp:comment_permlink>#</txp:comment_permlink></small>
It used to be <txp:message />
until I upgraded to 4.0.7. The problem existed under 4.0.5 and persists, of course, in 4.0.7.
comment_form works fine.
Offline
Re: Comments not appearing due to SQL error?
That’s totally freaky then. Don’t suppose you have a custom field called sort
do you? That would also kill it.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Comments not appearing due to SQL error?
Oh, Jesus H. McGillicuddy. Yup. It was a field created when I first started the site and was trying different sort options for different sections and it’s now no longer used but I never got rid of it.
Damn. I knew it had to be something dead simple and stupid. Thank you; it all works fine now.
Offline
Re: Comments not appearing due to SQL error?
kiplet wrote:
Thank you; it all works fine now.
No worries, glad it’s sorted (pun not intended).
That pesky custom field reserved words list should be tattooed on the Advanced Prefs page, imo. The number of times it’s caught me out when I’ve named a custom field ‘status’ or something… and it’s always the last place I think to look ;-) This is the first time I’ve known it to affect comments though.
EDIT: I’ve just updated the textbook entry to include a few other words I noticed would cause problems, ummm, that’s potentially any TXP tag attribute. Heck!
Last edited by Bloke (2009-01-01 17:11:33)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#8 2009-01-01 17:54:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Comments not appearing due to SQL error?
Bloke wrote:
That pesky custom field reserved words list should be tattooed on the Advanced Prefs page, imo.
Couldn’t agree more! Maybe we should post this in the Feature Ideas forum.
To begin with I copied the list of reserved names to the Advanced Preferences page in TextBook as well.
Offline