Fatal error with using item

Forum
Last Post
Threads / Messages

Kesstryl

Member
Member
Joined
Feb 22, 2012
Messages
204
Points
28
Mysidian Dollar
11,685
I'm experimenting with basic features of 1.3.6 and tried to use an item which should give 3 clicks on my pet. This error comes up whenever I try to use the item on the pet from the item page

An error has occurred...​

SQLSTATE[42000]: Syntax error or access violation: 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 'function = 'Click3'' at line 2
 
If you are using MySQL 8+, function becomes a reserved word. To fix the issue, replace function by `function` (enclose the text with backticks `).
 
ok, I will have to find where that is located, the code is constructed in bits and pieces. I was hoping for a pointer to where this error is occurring. i am using php 8.
 
Oh this error has nothing to do with PHP version, Mysidia Adoptables v1.3.6 should work on PHP 8. The issue is MySQL 8 which adds a new keyword that was not there in the past versions. I think it is located at file /model/domainmodel/itemfunction.php file, line 22:

PHP:
$whereclause = is_numeric($functioninfo) ? "ifid = :functioninfo" : "function = :functioninfo";

You need to replace it by:

PHP:
$whereclause = is_numeric($functioninfo) ? "ifid = :functioninfo" : "`function` = :functioninfo";

A very minor change, but to escape the keyword function with backtick `. Lemme know if this fixes your problem.
 
Thank you, that worked! Yes, I am running MySQL 8 as I'm using the latest version of Wamp.
 
You are very welcome. I am glad it works, and thank you for bringing up this issue. I thought Mys v1.3.6 should be compatible with latest technology, seems I forgot about MySQL 8.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,048
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top