Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 11790
Latest: ButtKoWitz
New This Month: 3
New This Week: 0
New Today: 0
Stats
Total Posts: 41408
Total Topics: 7255
Most Online Today: 80
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 74
Total: 74

Author Topic: Database error  (Read 3433 times)

0 Members and 1 Guest are viewing this topic.

Offline dan42101

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Database error
« on: November 28, 2013, 07:34:12 pm »
I get this error when trying to delete a comment from pic in user gallery...
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 'LIMIT 1' at line 2
File: /home/content/"My_Forum"/html/forum/Sources/Gallery2.php
Line: 3447


Version Information:
Forum version: SMF 2.0.6 (more detailed)
Current SMF version: SMF 2.0.6
GD version: bundled (2.0.34 compatible)
MySQL version: 5.0.96-log
Alternative PHP Cache: 3.1.13
PHP: 5.3.24
Server version: Apache

Contents of Gallery2.php lines 3423-3485:
function DeleteCommentByID($id)
{
    global $smcFunc, $txt, $modSettings;

    // Get the picture ID for redirect
   $dbresult = $smcFunc['db_query']('', "
   SELECT
      id_picture,id_comment, id_member
   FROM {db_prefix}gallery_comment
   WHERE id_comment = $id LIMIT 1");

   $row = $smcFunc['db_fetch_assoc']($dbresult);
   $picid = $row['id_picture'];
   $memID = $row['id_member'];
   $smcFunc['db_free_result']($dbresult);

   // Delete all the comment reports that comment
   $smcFunc['db_query']('', "DELETE FROM {db_prefix}gallery_creport WHERE id_comment = $id");
   // Now delete the comment.
   $smcFunc['db_query']('', "DELETE FROM {db_prefix}gallery_comment WHERE id_comment = $id LIMIT 1");


   // Update Comment total
    $smcFunc['db_query']('', "UPDATE {db_prefix}gallery_pic
      SET commenttotal = commenttotal - 1 WHERE id_picture = $picid LIMIT 1");

     // Update the SMF Shop Points
         if (isset($modSettings['shopVersion']))
            $smcFunc['db_query']('', "UPDATE {db_prefix}members
               SET money = money - " . $modSettings['gallery_shop_commentadd'] . "
               WHERE id_member = {$memID}
               LIMIT 1");

   return $picid;
}

function DeleteComment()
{
   global $smcFunc, $txt, $modSettings;

   is_not_guest();
   isAllowedTo('smfgallery_manage');

   $id = (int) $_REQUEST['id'];
   if (isset($_REQUEST['ret']))
      $ret = $_REQUEST['ret'];

   if (empty($id))
      fatal_error($txt['gallery_error_no_com_selected']);

   $picid = DeleteCommentByID($id);

   // Redirect to the picture
   if (empty($ret))
   {
      redirectexit('action=gallery;sa=view;id=' . $picid);
   }
   else
   {
      redirectexit('action=admin;area=gallery;sa=commentlist');
   }
}

Thanks in advance...

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15662
    • View Profile
Re: Database error
« Reply #1 on: November 29, 2013, 09:29:37 am »
Are you using the latest version of the gallery? It does not seem to match up to my line numbers.

If not please attach your Sources/Gallery2.php file.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline dan42101

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: Database error
« Reply #2 on: November 29, 2013, 01:14:55 pm »
I have the one that was at the link at the end of the PayPal process last Sunday...

Will send later tonight when I get home to main box if you like, can't do it from this cell ph.

Thanks.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15662
    • View Profile
Re: Database error
« Reply #3 on: December 01, 2013, 05:37:43 pm »
Let me know when you send it over.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
8723 Views
Last post February 09, 2008, 11:44:03 pm
by ApplianceJunk
4 Replies
4260 Views
Last post October 09, 2011, 03:59:37 pm
by SMFHacks
Database error

Started by davejo « 1 2 » Support

15 Replies
11610 Views
Last post March 23, 2013, 03:13:33 am
by davejo
3 Replies
2012 Views
Last post September 08, 2014, 11:47:21 pm
by SMFHacks
1 Replies
3238 Views
Last post October 04, 2014, 10:20:35 am
by SMFHacks

+- Recent Topics

Import downloads by mickjav
September 25, 2021, 04:47:13 am

Errors with 5.0.6 version by Hatshepsut
September 24, 2021, 10:21:24 pm

Forum ToolBox by mickjav
September 23, 2021, 03:20:07 pm

Ads Description is running into Ad Location by Shades
September 23, 2021, 09:56:42 am

S3 System For SMF Attachments by SMFHacks
September 21, 2021, 05:46:38 pm

Boards Icon by mickjav
September 18, 2021, 02:13:43 pm

Search Word Limit by SMFHacks
September 17, 2021, 08:41:01 pm

Item not appearing in category by SMFHacks
September 17, 2021, 08:39:45 pm

Undefined index: gallery_ad_seller by Shades
September 17, 2021, 01:23:10 pm

What happens if? by SMFHacks
September 14, 2021, 10:25:07 pm

Powered by EzPortal