Can't execute SQL

Helpdesk for my helpdesk software

Moderator: mkoch227

batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Can't execute SQL

Post 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
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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

Code: Select all

$hesk_settings['debug_mode']=0;
to

Code: Select all

$hesk_settings['debug_mode']=1;
- save, upload and test for the SQL error

Let us know what the SQL error says with debug mode on.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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 :D :D :D :D :D :D !!!!

Marc
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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 😁
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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 :)
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
batman93
Posts: 18
Joined: Thu Sep 20, 2018 3:02 pm

Re: Can't execute SQL

Post 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.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't execute SQL

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply