On these pages are my WordPress plugins, the odd article and my Support Forum.

For my random rantings on everything else please visit my blog at Yellow Swordfish

WP Plugins


Articles

If you find any of my plugins useful, please comsider a donation towards my running costs.

Thank you

In preparation for the release of Simple:Press Version 4.0, the Support Forum has moved to a new site dedicated to the plugin. This will also be the future home for Simple:Press Forum.


Version 3.1.4 will still be available for download here in the short term.


For the support forum - and to visit our new site and to get details of version 4.0, click on the logo to take you to simplepressforum.com

This forum is currently locked - access is read only
Current User: Guest
Please consider registering

 
Search Forums:


 




SQL error for admin only

UserPost

8:34 pm
3 Aug 2008


Mr Papa

Moderator

Arizona, USA

posts 1602

26

think Andy has this one by the tail now!!!  woot!

12:01 am
11 Aug 2008


Grant Barrett

Member

posts 62

27

I want to add here that I had this same thing happen and that the same code change suggested above worked for me, too.

Earlier I deleted a posted in the moderation thread and I changed the title of the parent to that post (but not the slug). It was a comment to another post. Shortly after, this error began appearing at the top of the thread:

WordPress database 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 'AND post_index = OR topic_id = AND post_index=1
ORDER BY post_id DESC' at line 6]

SELECT post_id, topic_id, forum_id, post_date, UNIX_TIMESTAMP(post_date) as udate, guest_name, wp_sfposts.user_id, post_index, post_status,
user_login, wp_sfmembers.display_name
FROM wp_sfposts
LEFT JOIN wp_users ON wp_sfposts.user_id = wp_users.ID
LEFT JOIN wp_sfmembers ON wp_sfposts.user_id = wp_sfmembers.user_id
WHERE topic_id = AND post_index = OR topic_id = AND post_index=1
ORDER BY post_id DESC;

At the same time, a new blank item appeared in the list of recent posts. There was no user name and no post name.

So I made the change to line 921 of the sf-database.php file. The error disappeared! Yay!

However, the parent post now does not display in the list of recent posts. I can find it in the appropriate section of the forum, where it is listed as having two posts, though it really only has one (Radio Producers of the World - Untie!).

Right now my phpMyAdmin access is not working, but when it does, I’ll go in there and delete the troublesome partially deleted post.

1:07 am
11 Aug 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

28

I think I have at last tracked this down actually - at least I am hoping so - but this does seem to confirm it. The problem does seem to arise when a post is deleted that is still held in the admins queue (sfwaiting table). It's been a real hard one to track down but your notes above do help confirm. Apologies for the bug - and all being well you should be able to avoid it by reading and loading the post and then moving away from it before deleting it. And it should then - I sincerely hope- be fixed in 3.2

11:57 pm
13 Aug 2008


wmburke

New Member

Washington, DC

posts 2

29

I intend this to be helpful, and hope that it either verifies your current understanding of the problem or leads to a better solution.

I have the same initial problem on a new install of v3.1.3:

WordPress database 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 '' at line 3]
SELECT topic_slug FROM wp_sftopics WHERE topic_id=

WordPress database 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 '' at line 3]
SELECT topic_slug FROM wp_sftopics WHERE topic_id=

I arrived at this place while testing the forum:

  1. I created new groups, discussions, and permission sets.
  2. I visited the site with Epiphany browser in Ubuntu and created a new topic under one of the forums. I then created a reply to that new topic as well.
  3. I visited the forum logged in as admin in firefox 3.0 - noticed that I had a new post to review (I think it hadn't had time to update for the second as of yet).
  4. I clicked to show the new posts. It showed me the first one. I clicked to delete it and the error appeared in its place.
  5. Honestly, at this point, I don't remember exactly what I did, but with repeated attempts to delete the blank posts that was showing there with the error above and refreshing the page, the error migrated from within the post display area to the very top of the page. It seems happy there at this point.
Troubleshooting:
  1. I checked the sfwaiting table and found the only entry to have topic_id: 1, forum_id: 2.
  2. I jumped over to the sfposts table and found the only entry to have the same topic_id and forum_id.
  3. I deleted them both, and sure enough the error has gone away.

I am now going to attempt to add new posts to the forum again and will let you know if there are any problems.

12:19 am
14 Aug 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

30

Yes that is helpful thank you.

I believe the problem is definitely traced to deleting a post that is in the waiting queue when there is a second post in the queue for the same topic. This appears to be borne out by your scenario above which is useful to me.

This can be worked around by not deleting posts that are still in the queue. Hopefully the fix I have out in place for 3.2 will resolve this once and for all. It is a very annoying error of course.

Thanks again.

12:53 am
14 Aug 2008


wmburke

New Member

Washington, DC

posts 2

31

You are correct. I was able to post and delete a single guest post easily, while adding two in a row recreated the issue.

Elementary, my dear Watson. Good show.

I'll look forward to the next version and know how to avoid trouble in the meantime.

Best,
Wayne

2:23 am
14 Aug 2008


Mr Papa

Moderator

Arizona, USA

posts 1602

32

Whew….   finally put to rest, I hope…  Good job Andy!

9:51 am
14 Aug 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

33

This also gives me a firm basis for testing - thanks. It's what we have been needing.



Reply to Topic: SQL error for admin only

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 4 + 12        (Required)

Topic Reply:


 
 

About the Stuff at Yellow Swordfish forum

Currently Online:

10 Guests

Maximum Online: 71

Forums:

Groups: 3

Forums: 16

Topics: 2068

Posts: 14091

Members:

There are 1003 members

There are 837 guests


Yellow Swordfish has made 5252 posts

Top Posters:

Mr Papa - 1602

-Radio- - 558

ovizii - 114

jfv - 82

angelic007 - 72

Administrator: Yellow Swordfish | Moderators: Yellow Swordfish, Mr Papa, -Radio-


© Simple:Press Forum - Version 3.1.4 (Build 357)