Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-18 03:24:09

magicRob
Member
Registered: 2005-12-26
Posts: 14

link_to_prev & SQL generation error

Hi,

I setup the very cool widescreen photoblog template but on my archive page (http://www.rovingrob.com/archive), which is in debug mode, i’m getting an error:

tag_error <txp:link_to_prev> ->  Textpattern Error: 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 'Section = 'archive'and Status=4 and Posted < now() order by Posted desc limit 1' at line 1
select ID, Posted from `textpattern` where 1=1 Section = 'archive'and Status=4 and Posted < now() order by Posted desc limit 1  on line 61*

Notice it does a “where 1=1 Section=…”. It’s missing either an “and” or it’s putting the 1=1 when it doesn’t need to. I thought it may be related to the theme but i’m having 2nd thoughts, hence this post.

If you look in the debug information being printed you get this:

txp:link_to_prev [SQL (0.000089): select ID, Posted from `textpattern` where 1=1 Section = ‘archive’and Status=4 and Posted < now() order by Posted desc limit 1] [SQL (0.000310): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where Posted > ’1969-12-31 17:00:00’ and Section = ‘archive’ and Status=4 and Posted < now() order by Posted asc limit 1] [SQL (0.000157): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where Posted < ’1969-12-31 17:00:00’ and Section = ‘archive’ and Status=4 and Posted < now() order by Posted desc limit 1]
/txp:link_to_prev

So it does look as if that SQL isn’t being generated correctly in this case…

Last edited by zem (2006-06-18 12:03:25)

Offline

#2 2006-06-18 04:13:09

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: link_to_prev & SQL generation error

I think you’ll find this is fixed in svn.


Alex

Offline

#3 2006-08-15 06:40:02

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: link_to_prev & SQL generation error

FAQ: “How do I fetch the current development version?”:“http://textpattern.com/faq/103/how-do-i-fetch-the-current-development-version
TextBook: “ Using Subversion (SVN)”:http://textbook.textpattern.net/wiki/index.php?title=Designer_and_Developer_Interests

Please do not use the “Report” link for asking questions.

Offline

Board footer

Powered by FluxBB