Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4214
Latest: thatsjustit
New This Month: 5
New This Week: 3
New Today: 0
Stats
Total Posts: 42792
Total Topics: 7455
Most Online Today: 77
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 54
Total: 54

Author Topic: Database error  (Read 3791 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: 16234
    • 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: 16234
    • 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
9983 Views
Last post February 09, 2008, 11:44:03 pm
by ApplianceJunk
10 Replies
9281 Views
Last post February 24, 2009, 08:08:08 pm
by Beltazar
4 Replies
4772 Views
Last post October 09, 2011, 03:59:37 pm
by SMFHacks
3 Replies
2129 Views
Last post September 08, 2014, 11:47:21 pm
by SMFHacks
1 Replies
4125 Views
Last post October 04, 2014, 10:20:35 am
by SMFHacks

+- Recent Topics

prettyurls - TroubleShooting.wiki by SMFHacks
Today at 01:49:35 pm

Download Gallery Option by SMFHacks
March 23, 2023, 09:34:02 am

Lost attachments by pete
March 22, 2023, 10:24:17 am

Additional Permissions by mickjav
March 18, 2023, 05:21:23 am

[Mod]Discord Web Hooks by SMFHacks
March 17, 2023, 08:48:30 am

Site upgrade to 2.1 by SMFHacks
March 12, 2023, 08:51:19 am

Theme/CSS design wanted by mickjav
March 11, 2023, 12:10:11 pm

Category Images by Anmer
March 10, 2023, 06:20:04 am

DownloadsPro - Topic Link by Anmer
March 08, 2023, 03:18:05 pm

Bulk File Import by SMFHacks
March 08, 2023, 07:56:23 am

Powered by EzPortal