Announcement

  •  » Requests
  •  » Error in functions_mysqli.inc.php on line 847 ?

#1 2022-01-14 21:27:35

vincelight
Member
2014-01-27
16

Error in functions_mysqli.inc.php on line 847 ?

Hi,
I upgrade when I get the email to upgrade so always run the latest software. 
I'm getting an error message when I view 3 of my albums (I have dozens of albums).  Each album has a similiar error message (only difference is the category_id ):

Warning:  [mysql error 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 'ASC' at line 7

SELECT DISTINCT(image_id)
  FROM photos_image_category
    INNER JOIN photos_images ON id = image_id
  WHERE
    category_id = 82

   ORDER BY rank ASC
; in /home/vincelight/vincelight.com/photos/include/dblayer/functions_mysqli.inc.php on line 847


Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in /home/vincelight/vincelight.com/photos/include/dblayer/functions_mysqli.inc.php:908 Stack trace: #0 /home/vincelight/vincelight.com/photos/include/section_init.inc.php(317): query2array('\nSELECT DISTINC...', NULL, 'image_id') #1 /home/vincelight/vincelight.com/photos/index.php(12): include('/home/vinceligh...') #2 {main} thrown in /home/vincelight/vincelight.com/photos/include/dblayer/functions_mysqli.inc.php on line 908


    Piwigo 12.2.0 Check for upgrade
    Operating system: Linux
    PHP: 7.4.15 (Show info) [2022-01-14 12:06:43]
    MySQL: 8.0.26-0ubuntu0.20.04.2 [2022-01-14 12:06:43]
    Graphics Library: ImageMagick 6.9.7-4
    Cache size N/A   never calculated Refresh


Piwigo URL: http://vincelight.com/photos
error can be found if clicking one of the albums   
   2019 Mom Surprise Bday
   0 Hattiesburg 131 40th
   2017 VT_Dropoff
My album is hosted by DreamHost

Offline

 

#2 2022-01-14 23:15:09

erAck
Only trying to help
2015-09-06
1219

Re: Error in functions_mysqli.inc.php on line 847 ?

Can you try if applying these patches helps?

Code:

--- admin/configuration.php
+++ admin/configuration.php
@@ -178,7 +178,7 @@ if (isset($_POST['submit']))
             $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2));
 
             // there is no rank outside categories
-            if ( ($i = array_search('rank ASC', $order_by)) !== false)
+            if ( (($i = array_search('`rank` ASC', $order_by)) !== false) || (($i = array_search('rank ASC', $order_by)) !== false) )
             {
               unset($order_by[$i]);
             }
--- admin/element_set_ranks.php
+++ admin/element_set_ranks.php
@@ -198,7 +198,7 @@ $sort_fields = array(
   'hit ASC'             => l10n('Visits, low → high'),
   'id ASC'              => l10n('Numeric identifier, 1 → 9'),
   'id DESC'             => l10n('Numeric identifier, 9 → 1'),
-  'rank ASC'            => l10n('Manual sort order'),
+  '`rank` ASC'          => l10n('Manual sort order'),
   );
 
 $template->assign('image_order_options', $sort_fields);

Update 2022-01-15T11:01+01:00
Corrected change in admin/configuration.php


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2022-01-15 01:41:12

vincelight
Member
2014-01-27
16

Re: Error in functions_mysqli.inc.php on line 847 ?

Thanks for your help because there is no way I could fix this by myself!
I do not know how to apply those changes you suggested.  I've managed to download the files, make copies, open the original with notepad, however I can not locate the lines you want changed.  I either don't know what I'm doing (high possibility) or my files do not match your files.  For example, in element_set_ranks.php my file has
starting at line 272
// image order management
$sort_fields = array(
  '' => '',
  'date_creation' => l10n('Creation date'),
  'date_available' => l10n('Post date'),
  'average_rate' => l10n('Average rate'),
  'hit' => l10n('Most visited'),
  'file' => l10n('File name'),
  'id' => 'Id',
  'rank' => l10n('Rank'),
  );
and that's the text which appears to be the closest match to yours.  And, unfortunately, there is no version number or identifier inside the file which could prove we're looking at the same file. :-(

Offline

 

#4 2022-01-15 11:21:07

erAck
Only trying to help
2015-09-06
1219

Re: Error in functions_mysqli.inc.php on line 847 ?

You are not looking at file admin/element_set_ranks.php of Piwigo 12.2.0 that has only 228 lines, see also
https://github.com/Piwigo/Piwigo/blob/7 … s.php#L184

The code context in the patch starts at line 198, the line to change is 201.

Note that I updated the change of admin/configuration.php


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2022-01-15 18:00:19

vincelight
Member
2014-01-27
16

Re: Error in functions_mysqli.inc.php on line 847 ?

So somehow my installation has gotten out of sync with the distribution even though I've followed along with the updates.  :-(  If this one file is out of sync, I have to wonder if other files are also out of sync :-(

Is there an easy way to force a resync?
Or do I need somehow down load the entire distribution and re-install it?

Not being very mysql savy i'm concerned and worried about losing things.
Thanks for your advice....

Offline

 

#6 2022-01-15 18:21:23

vincelight
Member
2014-01-27
16

Re: Error in functions_mysqli.inc.php on line 847 ?

I've started a manual update by down loading the 12.2.0 release, unpack locally on my PC...and making the changes before uploading them to my site.

Taking a closer look at the suggested changes to configuration.php
-            if ( ($i = array_search('rank ASC', $order_by)) !== false)
+            if ( (($i = array_search('`rank` ASC', $order_by)) !== false) || (($

and it doesn't look right..? is there a missing ")"   also the end of the line looks hanging "|| (($"

I'm thinking something got truncated.

Offline

 

#7 2022-01-15 20:58:43

erAck
Only trying to help
2015-09-06
1219

Re: Error in functions_mysqli.inc.php on line 847 ?

No no no, that's wrong. From the original source you have to remove the line that starts with - minus and add the line that starts with + plus, without those minus and plus characters of course. (and note the line is longer, the code window is scrollable, so you'd have to copy the entire line).

However, if your sources are out of sync then rather update with the new original and try that first without modifications. Please follow the Manual Update guide.


Running Piwigo at https://erack.net/gallery/

Offline

 

#8 2022-01-15 22:04:28

vincelight
Member
2014-01-27
16

Re: Error in functions_mysqli.inc.php on line 847 ?

Thanks for the pointer, I didn't realize the adjustments scrolled to the right.  silly me.

Just finished manually uploading the entire distribution, with mods to those two files.
Good news is my website still works.
Bad news is the problem still exists for those 3 albums.

albums with the problem: (in vincelight.com/photos)
2019 Mom Surprise Bday
0 Hattiesburg 131 40th
2017 VT_Dropoff

is it a coincidence those 3 albums are next to each other?   all my other albums are fine.

Offline

 

#9 2022-01-17 13:44:26

vincelight
Member
2014-01-27
16

Re: Error in functions_mysqli.inc.php on line 847 ?

By changing the sort order from Manual to Automatic, the problem went away.
This used to work, but recently broke.

So there must be some bug in the code that sorts manually.

Last edited by vincelight (2022-01-17 13:45:07)

Offline

 
  •  » Requests
  •  » Error in functions_mysqli.inc.php on line 847 ?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact