Page 1 of 2
Can't execute SQL
Posted: Fri Mar 12, 2021 5:47 pm
by batman93
Script URL:
Version of script: 3.2.1
Hosting company: GreenGeek
URL of phpinfo.php:
https://iwisac.com/WHInter/phpinfo.php
URL of session_test.php:
https://iwisac.com/WHInter/session_test.php
What terms did you try when SEARCHING for a solution: "Can't execute SQL"
Write your message below:
I moved to a new host.
I reinstalled HelpDesk and so far it works... partially.
I can read all my KB but not the tickets.
In the admin I often have "Can't execute SQL" or if I try to change the settings, I have "Error - Invalid request"
Any idea ?
Thanks !
marc
Re: Can't execute SQL
Posted: Fri Mar 12, 2021 7:35 pm
by Klemen
Your server has problems with PHP sessions in general - they do not work (see the session_test.php file).
This is something to ask your host about, most likely a problem with the session.save_path parameter of PHP (wrong path, folder not writable by PHP, out of disk space, ...)?
As for the SQL error:
If you can login into the admin panel go to Settings > Help desk and turn Debug mode ON. Then you should get a more verbose error message.
If you cannot login to admin, turn debug mode ON manually:
- download hesk_settings.inc.php from the server
- open it in
Notepad++ or some other powerful editor (not Microsoft Notepad)
- change
to
- save, upload and test for the SQL error
Let us know what the SQL error says with debug mode on.
Re: Can't execute SQL
Posted: Fri Mar 12, 2021 8:14 pm
by batman93
Hi
Frist thanks for that very quick answer !!!
1/ The session.save_path seems to be ok, the permission is 0700
2/The debug mode gave this:
Can't execute SQL: SELECT COUNT(*) AS `cnt`, `status`, IF (`owner` = 1, 1, IF (`owner` = 0, 0, IF (`assignedby` = 1, 3, 2) ) ) AS `assigned_to`, IF (`due_date` < NOW(), 2, IF (`due_date` BETWEEN NOW() AND (NOW() + INTERVAL 7 DAY), 1, 0) ) AS `due` FROM `hesk_tickets` WHERE 1 AND 1 AND `status` IN ('0','1','2','4','5') GROUP BY `assigned_to`, `due`, `status`
MySQL said:
Unknown column 'due_date' in 'field list'
Thanks !!!
Marc
Re: Can't execute SQL
Posted: Fri Mar 12, 2021 8:22 pm
by Klemen
Your session test file (as simple as it gets) does not work, so PHP sessions on your server do not work:
https://iwisac.com/WHInter/session_test.php
The SQL error means your database is not 3.2.x compatible. Did you upgrade from a previous Hesk version? If yes, the upgrade was not complete, did you run the upgrade script?
Re: Can't execute SQL
Posted: Fri Mar 12, 2021 10:06 pm
by batman93
Hi,
Indeed I upgraded it but something went wrong.
After a moment y had the feeling it was right. It wasn't ...
Is there a way to get the number of previous version to reinstall that one?
The las upgrade was a few months ago , so maybe 3.1.x
Thanks
Re: Can't execute SQL
Posted: Sat Mar 13, 2021 8:01 am
by Klemen
Do you have a backup from before the upgrade?
You can try downloading 3.2.1 from here:
https://www.hesk.com/download-legacy.php
From that file upload just the install folder to your help desk and run the update.
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 12:11 am
by batman93
Hi !
Yes ,fortunately but... the previsous backup was altered already. When something has to go wrong... it will go wrong !
But ... it is
SOLVED thanks to you!!!
I did this:
I had the database in the backup so I used that one.
I downgraded HESK to 3.1.0 as you suggested it.
I finally adjusted hesk_settings.inc.php
and it works !!!
This was a bit messy but it's solved.
There was no PHP issue after all !
Thanks

!!!!
Marc
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 12:38 am
by batman93
I actually have some other issues.. ;(
I have now 3.1.0 working fine.
Remaining issues:
I noticed I dont have the search bar anymore... not all the KB stuff is on the home page as it was before.
When I try to change any setting I have "Invalid request".
When I try to upgrade to 3.2.2 the install script remains on "Do you accept the HESK Software End-User License Agreement?" - When I click on "I accept" it doesn't move forward... (I tried a fresh installation in a different folder and I have the same issue)
It really seems I have different versions ... and that generates conflicts.
I guess the best it to reinstall all. But I want to keep my database. So is there a way to see what HESK version corresponds to my database?
Thanks !
Marc
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 7:52 am
by Klemen
The session issue could be caused by manual modifications to the settings file if empty lines or hidden UTF-8 BOM are there.
Try this:
1. create a new full backup
2. do this to your hesk_settings.inc.php:
https://www.phpjunkyard.com/support/kb/ ... article=40
3. download a clean copy of 3.2.2 and upload everything except hesk_settings.inc.php
4. run the update script
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 1:27 pm
by batman93
Thanks,
Unfortunately that way my database won't be compatible.
I noticed that between 3.1 a d 3.2 2 columns were Added to the tickets table.
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 1:30 pm
by Klemen
Well the point is to upgrade to 3.2.2, isn't it? The upgrade script should detect what version of the database you have, and update to 3.2.2
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 8:24 pm
by batman93
Maybe I didn't get it.
In an upgrade, I assume that the script also updates the database
But with a new and fresh 3.2 installation, and using the 3.1 database - I tested that already - it does not work, that is actually what I did at the very beginning and originated this post

Re: Can't execute SQL
Posted: Sun Mar 14, 2021 8:28 pm
by Klemen
Ok, let's try again
1. you have a database that is not 3.2.2, for example, 3.1.1
2. you upload 3.2.2 files and run the update script
3. the update script will detect your version as 3.1 and update your database to 3.2.2
4. now you have 3.2.2 files with the database upgraded to 3.2.2
Not sure how to make it clearer

Re: Can't execute SQL
Posted: Sun Mar 14, 2021 8:31 pm
by batman93
Haha !
I will try that. Again
However, I tested that already, it when I run the upgrade script it loops ate the first step, when I click on the accept button.
Re: Can't execute SQL
Posted: Sun Mar 14, 2021 8:34 pm
by Klemen
Well, it will not work until you (your host) fix PHP sessions on the server. That's the first thing you need to do and that's not something Hesk-specific or something someone here can do for you.