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

2:14 am
29 Jul 2008


jtpratt

Member

MI, USA

posts 23

1

I have a very weird error that only occurs for me when logged in as admin.  I can view the forum, but I get this error at the top of the page -

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=

The forum has been working for me for the past few months no problems at all, and then just yesterday I got it for the first time.  I logged out as admin and as guest it goes away.  I upgraded today to your latest version thinking it would help, but I still get the error.

WP ver 2.6, PHP 5.x+, MySQL 4.x

You can see my forum at http://www.jtpratt.com/forum

Let me know if you need more specifics…

8:58 am
29 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

2

When you load the front page of the forum (as admin) I assume you are showing new posts at the bottom? (I see you are showing new posts for members/guests).

My guess is that one of those entries in the new posts list as no detail - i.e., no start/end post ibnforamtion or anything. That one is the cause.

I am desperately trying to track down this problem. It does not happen that often and I have not been able to replicate it here or on my test sites. But some specfic dequence of events causes this and until I know what they are it might be impossible to fix.

Do you have access to your database? Via a tool like phpMyAdmin. You are going to need to delete that post - it will be recent and it will have missing data maybe in the topic_id column - ot it will hve the wrong topic_id. I am sorry but I know of no other way to deal with it until we figure the root cause.

And if you have any notions on what may have caused it please let me know as this might help fix it once and for all.

3:32 pm
29 Jul 2008


jtpratt

Member

MI, USA

posts 23

3

there's only 50 posts, and they all have a topic id, including the last one. I have a topic_id of 23, which I checked - and it was right.  It was waiting for moderation, so I set it to approved by setting the status to zero in phpMyAdmin.  I still get the error.  I deleted that record, and each and every record remaining is approved.

so I logout as admin - and now I see this as guest:

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;

I logged back in admin, and in the new/unread posts there is a blank post (which says it is the first of 6, but only the blank one displays) - and when you try to delete it it disappears, but bringing up new/unread again - it's still there.

So I go back to the database in phpMyAdmin, and in the wp_sfposts table there are no record with no data.  So, now I'm lost.

What Next?

5:40 pm
29 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

4

I have spent most of today tryign to track this down. Know what the error is but just can't find the cause. But - still a way to go.

The problem is that one of your posts has the wrong topic ID. What I can do, as a temporary measure, is exclude that post until we can find the best way to get it back. if you are up to a simple code edit? if so…

Open the file /forum/sf-database.php and scroll down to:

function sf_combined_new_posts_list($posts)

I am afraid it'sa long way down - line 904…

Near the bottom is this line of code:

$postlist[]=$record;

It needs to be changed so that it all reads:

if ( $record ) $postlist[]=$record;

Do NOT copy and paste this - type it in and save it.

If I am right then the display error should go away. I hope. This does leave a stranded post and I am workign on that at the moment.

8:36 pm
29 Jul 2008


jtpratt

Member

MI, USA

posts 23

5

Well, I did exactly what you said  - but the error is still there.  I did verify that I had the right permissions to edit the file and make the change, and I checked to make sure it took, but the exact same error is still there.

8:53 pm
29 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

6

When I visit your site as a guest I don't see any error or error message.

Can you tell me how I can get top see this error…?

And I guess maybe I have wasted a day looking doen the wrong code file…!

9:01 pm
29 Jul 2008


jtpratt

Member

MI, USA

posts 23

7

it's the same error I first posted, admin gets it or unread items.

create an account in my forum, and I'll make you admin.  You should see it then.

9:37 pm
29 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

8

OK - done that

1:00 am
30 Jul 2008


jtpratt

Member

MI, USA

posts 23

9

you've been added as moderator, try logging in.

9:26 am
30 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

10

Right - as far as I can tell (and I may  still be wrong!) the problem post is within that group awaiting moderation. It says there are 6 posts in one thread.

One of those posts will have the wrong 'topic_id'.

If you can, take a look in the 'sfwaiting' table. if all is well, you should have 1 entry (as of 9:15am UK time) and it will tell you what the forum ID and topic ID are. If you are then able to look into the 'sfposts' table, starting with the most recent forum posts (i.e. the higher post IDs) see if you can find the ones with that forum_id and topic_id although one of them will either have an emptytopic_id or - more likely - the WRONG topic_id. That post is the problem post.

I spent yesterday working through this. While I have not found the actual root of the problem yet I have 'cleaned' a lot of code and will be doing some more work on this today. I am just hoping as a track through it I will stumble on the cause. I am also hoping that I might be able to include some 'housekeeping' routines in 3.2 so that at the very least f this problem occurs the admin may be able to correct it easily.

I am just sorry this bug continues to elude me.

5:55 pm
30 Jul 2008


jtpratt

Member

MI, USA

posts 23

11

there's only 1 entry in the sf_waiting table…also the last 9 entries in sf_topics have topic id's, and they appear to be right.

topic_id forum_id post_count post_id user_id
      23 11 6 36

0

8:09 am
31 Jul 2008


para008dk

Member

posts 6

12

WordPress database error: [MySQL server has gone away]
SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_user_level' AND meta_value != '0'

WordPress database error: [MySQL server has gone away]
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_parent = 21 AND wp_posts.post_type = 'revision' AND (wp_posts.post_status = 'inherit') ORDER BY wp_posts.post_date DESC

 

I am using the latest version and this thing is shown when I open the forum page in my dashboard.Its appearing under advanced options.Has something gone wrong with my database.

I hope that you say no!! Wink

8:46 am
31 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

13

jtpratt said:

there's only 1 entry in the sf_waiting table…also the last 9 entries in sf_topics have topic id's, and they appear to be right.

topic_id forum_id post_count post_id user_id
      23 11 6 36

0


is there any possibility you could do an  'export' of your forum tables (just those starting 'sf') and send me the resulting sql script? Actually seeing the data might help me enormously nd at the very least I should be able to track down the problem…

I will send you a PM with an email address. If you don't know how to do it I can send instructions - it's very easy.

8:52 am
31 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

14

para008dk said:

WordPress database error: [MySQL server has gone away]
SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_user_level' AND meta_value != '0'

WordPress database error: [MySQL server has gone away]
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_parent = 21 AND wp_posts.post_type = 'revision' AND (wp_posts.post_status = 'inherit') ORDER BY wp_posts.post_date DESC


[Later I will move this to it's own thread or remove as I do ot want to hijack this one]

did you look at the actual sql errors? These are WP tables and queries - not forum tables and queries. And I do not know what 'advanced options' are. It also says your MySQL server has 'gone away'. I am not sure if this is a timeout or something. And I really do not know why those queries are running…

9:03 am
31 Jul 2008


para008dk

Member

posts 6

15

no please remove this I don't want an hijack.Remove both the posts.

But I don't think that someone would hijack because I haven't started making my forums yet as I cannot even see them!!

It shows the error radomly.Sometime it shows and sometimes not.


9:09 am
31 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

16

I was referring to posting in this thread witha different question. It's only because this is an important thread and I would prefer it to stay with the problem rather than get sidetracked onto other problems.

As I said, this is not a forum problem. These are not forum queries, tables or anything the forum is doing. What makes you think it is the forum?

6:40 pm
31 Jul 2008


jtpratt

Member

MI, USA

posts 23

17

I just sent you the database tables in email.

thanks for looking into this!


- John


Yellow Swordfish said:

jtpratt said:

there's only 1 entry in the sf_waiting table…also the last 9 entries in sf_topics have topic id's, and they appear to be right.

topic_id forum_id post_count post_id user_id
      23 11 6 36

0


is there any possibility you could do an  'export' of your forum tables (just those starting 'sf') and send me the resulting sql script? Actually seeing the data might help me enormously nd at the very least I should be able to track down the problem…

I will send you a PM with an email address. If you don't know how to do it I can send instructions - it's very easy.


7:36 pm
31 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

18

I have just sent you an email…

9:39 pm
31 Jul 2008


para008dk

Member

posts 6

19

    WordPress database error: [MySQL server has gone away]
    SELECT forum_id, usergroup_id, permission_role FROM wp_sfpermissions ORDER BY permission_id

    WordPress database error: [MySQL server has gone away]
    SELECT role_id, role_actions FROM wp_sfroles ORDER BY role_id

    WordPress database error: [MySQL server has gone away]
    SELECT * FROM wp_sfmembers WHERE user_id = 1

    WordPress database error: [MySQL server has gone away]
    SELECT DISTINCT forum_id, topic_id FROM wp_sfposts ORDER BY post_id DESC LIMIT 10

        this is appearing in the recentt forum activity widget


Is this a similar problem.What to do I am getting scared that I may need to start again everything!!


10:21 pm
31 Jul 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

20

This is not a forum issue. Your database server connection has closed.

I suggest you read through this.

6:28 pm
3 Aug 2008


jtpratt

Member

MI, USA

posts 23

21

well, the fix you gave me worked like a charm.  Then I approved a few more forum posts after that.  Today I got a post where the guy quoted the previous post but didn't add anything, so I deleted it.

The error returned -


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=

6:41 pm
3 Aug 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

22

Casn you do what you did last time please. Quick before you get too much more activity. Is this just in the Admin vierw again by the way?

Oh yes - I still can't find the bit of code that is causing this however!

6:57 pm
3 Aug 2008


jtpratt

Member

MI, USA

posts 23

23

sure, I'll send it to you right away…

7:02 pm
3 Aug 2008


Yellow Swordfish

Admin

Peterborough, England

posts 5252

24

And is it admin only?

It would be a great helo if you could tell me what topic it is that you deleted the post from?

And… was that post you deleted awajiting moderation by any chance?

7:08 pm
3 Aug 2008


jtpratt

Member

MI, USA

posts 23

25

same topic as last time - 23 I think?  Yes, admin only.



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: 1 + 6        (Required)

Topic Reply:


 
 

About the Stuff at Yellow Swordfish forum

Currently Online:

14 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)