SMFHacks.com

SMF Gallery Pro => Support => Topic started by: ApplianceJunk on February 09, 2008, 10:26:22 pm

Title: Database Error: You have an error in your SQL syntax?
Post by: ApplianceJunk on February 09, 2008, 10:26:22 pm
Not sure what is going on with this error.

Here is what is shows in the error log.

Quote

 Guest                                            Today at 05:59:32 PM 
 99.238.77.127                              b6b3c1ed72d122452b7f9d4425b846d3 

 http://appliancejunk.com/forums/index.php?action=gallery;sa=prev;id=421
 
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 USER_ID_CAT = AND approved = 1 AND ID_PICTURE > 421 LIMIT 1' at line 1
File: /home/content/a/p/p/appliancejunk/html/forums/Sources/Gallery.php
Line: 4763

 

So I go to my forums/Sources/Gallery.php and look at line 4763 and see this.

Code: [Select]
$dbresult = db_query("SELECT ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $ID_CAT AND USER_ID_CAT =
Here is a little larger section of that code.

Code: [Select]
//Get previous image
$dbresult = db_query("SELECT ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $ID_CAT AND USER_ID_CAT = $USER_ID_CAT AND approved = 1 AND ID_PICTURE > $id  LIMIT 1", __FILE__, __LINE__);
if(db_affected_rows() != 0)
{
$row = mysql_fetch_assoc($dbresult);
$ID_PICTURE = $row['ID_PICTURE'];
}
else
$ID_PICTURE = $id;

mysql_free_result($dbresult);

redirectexit('action=gallery;sa=view;id=' . $ID_PICTURE);
}
function NextImage()
{
global $db_prefix, $txt, $scripturl;

$id = (int) $_REQUEST['id'];
if(empty($id))
fatal_error($txt['gallery_error_no_pic_selected']);

So it seems to be something that happens when a guest clicks to Get previous image, correct?

Not sure what I need to do or look at to correct this.

Any help would be appreciated.

Thank you,
 AJ


Title: Re: Database Error: You have an error in your SQL syntax?
Post by: SMFHacks on February 09, 2008, 10:42:04 pm
Figured it out appears that image was deleted.
http://appliancejunk.com/forums/index.php?action=gallery;sa=view;id=421

And the user/bot was following an old link.
Title: Re: Database Error: You have an error in your SQL syntax?
Post by: ApplianceJunk on February 09, 2008, 11:31:17 pm
Figured it out appears that image was deleted.
http://appliancejunk.com/forums/index.php?action=gallery;sa=view;id=421

And the user/bot was following an old link.

ok, I was kind of wondering if it was something like that as it started to happen after I removed half a dozen photos from the gallery and a couple of the "guest" were goggle when I checked on there IP's.

So there is nothing I should have to repair or change, correct?

Title: Re: Database Error: You have an error in your SQL syntax?
Post by: SMFHacks on February 09, 2008, 11:34:26 pm
Not really. I can add a check to that function just to stay that picture no longer exists if it becomes an issue.
Title: Re: Database Error: You have an error in your SQL syntax?
Post by: ApplianceJunk on February 09, 2008, 11:44:03 pm
Not really. I can add a check to that function just to stay that picture no longer exists if it becomes an issue.

Ok, I don't think it will become a issue for me.

Thanks for your fast replies.