Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online Now
2 registered members (isaac, Gizmo), 74 guests, and 394 spiders.
Key: Admin, Global Mod, Mod
Member Spotlight
M4TT
M4TT
Canada, SK
Posts: 51
Joined: March 2015
Show All Member Profiles 
Top Posters(30 Days)
Gizmo 18
M4TT 12
FREAK 11
Ruben 8
mmkk 5
isaac 4
Latest Photos
Chinese Buddhist temple.
My buddha beads.
Rendered Walls
Multi-Screen wallpaper
Stockholm Metro
Previous Thread
Next Thread
Print Thread
SQL Error in 7.5.7 - postlist.inc.php #251499
12/17/12 06:18 PM
12/17/12 06:18 PM
Joined: Jun 2006
Posts: 754
BellaOnline Offline OP

old hand
BellaOnline  Offline OP

old hand
Joined: Jun 2006
Posts: 754
I'm getting errors in my error log now that I've upgraded to 7.5.7. They read:

Sun, Dec 16 2012 04:44:11 -0500
Script: E:\forums\scripts\postlist.inc.php - Line: 511
select t1.TOPIC_ID,t1.POST_ID,t2.USER_DISPLAY_NAME,t1.TOPIC_CREATED_TIME,t1.TOPIC_LAST_REPLY_TIME,t1.TOPIC_SUBJECT,
t1.TOPIC_STATUS,t1.TOPIC_IS_APPROVED,t1.TOPIC_ICON,t1.TOPIC_VIEWS,t1.TOPIC_REPLIES,t1.TOPIC_TOTAL_RATES,
t1.TOPIC_RATING,t3.USER_NAME_COLOR,t2.USER_MEMBERSHIP_LEVEL,t1.USER_ID,t1.TOPIC_IS_STICKY,t1.TOPIC_LAST_POSTER_ID,
t1.TOPIC_LAST_POSTER_NAME,t1.TOPIC_LAST_POST_ID,t1.TOPIC_IS_EVENT,t1.TOPIC_HAS_FILE,t1.TOPIC_HAS_POLL,t1.TOPIC_POSTER_NAME,t1.TOPIC_THUMBNAIL,t4.POST_BODY,t3.USER_GROUP_IMAGES
from ubbt7_TOPICS as t1
left join ubbt7_USERS as t2 on t1.USER_ID = t2.USER_ID
left join ubbt7_USER_PROFILE as t3 on t1.USER_ID = t3.USER_ID
left join ubbt7_POSTS as t4 on t1.POST_ID = t4.POST_ID
where t1.FORUM_ID = 175
and t1.TOPIC_IS_STICKY = '0'

AND t1.TOPIC_IS_APPROVED = '1'
ORDER BY t1.TOPIC_LAST_REPLY_TIME desc
LIMIT -20, 11
- 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 '-20, 11' at line 14


My reading of the SQL syntax finds:
"LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements)."

So the -20 is negative. Is this considered a "prepared statement"?


Lisa Shea, owner, BellaOnline.com
BellaOnline Website
BellaOnline Forums - UBB since Apr 2002 - 57,000 members / 800,000 posts
Express Hosting
Express Hosting "We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
Re: SQL Error in 7.5.7 - postlist.inc.php [Re: BellaOnline] #251502
12/17/12 06:49 PM
12/17/12 06:49 PM
Joined: Apr 2007
Posts: 4,313
SoCal, USA
SD Offline
Carpal Tunnel
SD  Offline
Carpal Tunnel
Joined: Apr 2007
Posts: 4,313
SoCal, USA
bug has been in there since a long time..

postlist.inc.php

find:

PHP Code

	// If $page isn't set then it defaults to 1
	if (empty($page)) {
		$page = $_SESSION['currentpage'];
		if (!$page) {
			$page = 1;
		}
		if ($page < 1) $page = 1;
	}
 


change to:

PHP Code

	// If $page isn't set then it defaults to 1
	if (empty($page)) {
		$page = $_SESSION['currentpage'];
		if (!$page) {
			$page = 1;
		}
	}
	if ($page < 1) $page = 1;
 


it was always too trusting of the $page variable, if it was supplied in the URL.

this doesn't allow it to go 0 or negative.

the url that caused your error had a page of -1 in it.. ( default topics per is set to 10, so (-1 -1 ) * 10 --> 20... and a limit of 10+1 --> 11

smile

i will put this into the release... Brooks can notify when it is in the official .zip download smile

Re: SQL Error in 7.5.7 - postlist.inc.php [Re: BellaOnline] #251507
12/17/12 07:10 PM
12/17/12 07:10 PM
Joined: Jun 2006
Posts: 754
BellaOnline Offline OP

old hand
BellaOnline  Offline OP

old hand
Joined: Jun 2006
Posts: 754
OK thanks I've just made the change in all of my forums.

For those on 7.5.7 the line number is 115 where this is found.


Lisa Shea, owner, BellaOnline.com
BellaOnline Website
BellaOnline Forums - UBB since Apr 2002 - 57,000 members / 800,000 posts
Re: SQL Error in 7.5.7 - postlist.inc.php [Re: BellaOnline] #252385
02/26/13 02:10 PM
02/26/13 02:10 PM
Joined: Sep 2009
Posts: 37
Northern Ireland, UK
Mark J.Cairns Offline
newbie
Mark J.Cairns  Offline
newbie
Joined: Sep 2009
Posts: 37
Northern Ireland, UK
I'm also getting an error after 7.5.7 but it means I can't re-edit longer posts with formatting after the initial post.

Getting this:
[deleted my pathname here]/ubbthreads/scripts/modifypost.inc.php
Line#: 365
SQL Error: Incorrect key file for table '[deleted my pathname here] ubbt_POSTS.MYI'; try to repair it
SQL Error #: 126

Re: SQL Error in 7.5.7 - postlist.inc.php [Re: Mark J.Cairns] #252389
02/26/13 03:23 PM
02/26/13 03:23 PM
Joined: Dec 2003
Posts: 5,827
Lutz,FL
Ruben Offline

Ruben  Offline


Joined: Dec 2003
Posts: 5,827
Lutz,FL
Originally Posted by Mark J.Cairns
I'm also getting an error after 7.5.7 but it means I can't re-edit longer posts with formatting after the initial post.

Getting this:
[deleted my pathname here]/ubbthreads/scripts/modifypost.inc.php
Line#: 365
SQL Error: Incorrect key file for table '[deleted my pathname here] ubbt_POSTS.MYI'; try to repair it
SQL Error #: 126

You cross posted but read my two replies at:
https://www.ubbcentral.com/forums/ub...e_Board_security_key_keeps_ch#Post252388
Sounds to be a corrupted Mysql table.


Blue Man Group


There is no such thing as stupid questions. Just stupid answers

Shout Box
Today's Birthdays
No Birthdays
Recent Topics
Users Unable to Upload Avatar [Not a Bug]
by M4TT. 12/13/17 08:51 AM
Shout Box Sound Effect
by M4TT. 11/29/17 08:28 PM
Ad island
by TGCsanderson. 11/25/17 06:41 PM
Taking to long to connect to DB
by AstroCat. 11/24/17 12:34 PM
Forum Statistics
Forums36
Topics35,015
Posts190,544
Members12,045
Most Online978
Jun 24th, 2007
Random Image
Powered by UBB.threads™ PHP Forum Software 7.6.1
(Snapshot build 20171106)