Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 01:52 am EST

Geeklog Forums

post comments error in latest ver 1.3.8-2


Alex

Anonymous
surprised
I was so happy I passed the installation that other day Smile
Everything was fine until first story got published and people tried to comment it

When they do (press Post Comment) they get an error message:

An SQL error has occured. Please see error.log for details.

Thanks G., I have my errors.log turned-on, so I went there and read, here is the error from the log:

Tue Nov 11 22:55:56 2003 - 1064: 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 'WHERE (type = 'comment') AND (date
Now, assuming this message, I went to SQL and started researching on gl_comments table, comparing to working versions i have on other sites

All difference I found, was that this newest table had lot more indexes, not only PRIMARY for content, like others do. I though that's the evil so I dropped indexes, but it does not help

All the rest in the table is 1:1 as old one from what I can see (I may be wrong)

I also tried to substitute current comment.php with the older one but it also brought no success, so I returned it back

My only hope if I am not the only one who met this problem
 Quote

Alex

Anonymous
Real error message got cut when I posted it here because of < brackets

here is the full message from error.log:

Tue Nov 11 22:55:56 2003 - 1064: 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 'WHERE (type = 'comment'Wink AND (date < unix_timestamp() - 45)' at. SQL in question: DELETE FROM WHERE (type = 'comment'Wink AND (date < unix_timestamp() - 45)
 Quote

Alex

Anonymous
I found EXACT place for this error
lib-common.php, line 480 (latest edition)

Something is wrong in those lines:

$result = DB_query( "SELECT UNIX_TIMESTAMP(date) AS day,username FROM {$_TABLES['comments']},{$_TABLES['users']} WHERE {$_TABLES['users']}.uid = {$_TABLES['comments']}.uid AND sid = '{$A['sid']}' ORDER BY date desc LIMIT 1" );
$C = DB_fetchArray( $result );

Asd they give me this error in error.log:

Fri Nov 14 01:38:23 2003 - 1064: 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 'WHERE (type = 'comment'Wink AND (date < unix_timestamp() - 45)' at. SQL in question: DELETE FROM WHERE (type = 'comment'Wink AND (date < unix_timestamp() - 45)

When I am trying to post a comment

Please help with suggestions...
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The
Text Formatted Code
DELETE FROM  WHERE (type = 'comment') AND (date < unix_timestamp() - 45)
 
is for clearing the speed limit table (function COM_clearSpeedlimit in lib-common.php) and it's missing the table name, hence the error.

I can only think of two reasons how this could happen:

  1. The name of the table is missing from lib-database.php
  2. Something's wrong in the function in lib-common.php

Both of which shouldn't happen with a fresh install.

What did you use to edit the lib-common.php? Make sure you still have
Text Formatted Code

    global $_TABLES;
                                                                               
    $sql = "DELETE FROM {$_TABLES['speedlimit']} WHERE ";
 
in function COM_clearSpeedlimit.

bye, Dirk
 Quote

Alex

Anonymous
Your suggestion was right, it is lib-database.php Exclamation

When I had troubles with auto update and had to manually do it, I guess it missed the step to update this php file as well

As a result I had:
tables
['commentspeedlimit'] and ['submitspeedlimit'] were there, while absent in sql database already

tables
speedlimit and staticpage were not mentioned in lib-database.php, but they do exist in the database
So I manually deleted 2 entries and added 2 entries

Comments started working right away!

Thank you for your help, I think it is important update for people who failed on automatic update we discussed topic before, I will post it there
 Quote

All times are EST. The time is now 01:52 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content