close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

count AS with group by causing error locally

Thread began 3/02/2023 4:39 am by s.joiner74419001 | Last modified 8/23/2023 4:39 am by s.joiner74419001 | 384 views | 8 replies |

s.joiner74419001

count AS with group by causing error locally

Hi Ray. First and foremost I hope the treatment is going well. No urgency with this but i have an issue with a query that is working on our remote server but fails the page with a 500 error on the local server. I have tried to set PHP version the same on both.
The query is as follows:

<?php
$rsPayments = new WA_MySQLi_RS("rsPayments",$RTMFi,10);
$rsPayments->setQuery("SELECT registered_apps.acc_id, registered_apps.rtm_status, registered_apps.members, application_pcd.date_of_app, application_bi.premises_name, Count(consented_leaseholders.entry_id) AS Countentry_id FROM registered_apps INNER JOIN application_pcd ON registered_apps.app_id = application_pcd.application_id INNER JOIN application_bi ON application_pcd.application_id = application_bi.applicant_id LEFT OUTER JOIN consented_leaseholders ON application_bi.applicant_id = consented_leaseholders.app_id WHERE consented_leaseholders.fee = 'Unpaid' AND registered_apps.product_type != 'CCO' GROUP BY application_bi.premises_name ORDER BY application_pcd.date_of_app DESC");
$rsPayments->execute();
?>
The databases are the same remotely and locally...

I’ve attached screenshots of phpMyAdmin settings for both remote and local servers.

Any idea what’s causing it to fail locally only?

Thanks in advance!
Steve

Sign in to reply to this post

Ray BorduinWebAssist

A 500 error is a general error that means "I'm not showing you the real error".... add this to the top of the page:
<?php
ini_set("display_errors",1);
?>

Then you might get the full error that will point you in the right direction.

Sign in to reply to this post
Did this help? Tips are appreciated...

s.joiner74419001

Hi Ray, I've put error result in a pdf. See attached.

Any ideas on this?

Many thanks
Steve

Attached Files
error_result.pdf
Sign in to reply to this post

Ray BorduinWebAssist

This one is the error:
Fatal error: Uncaught mysqli_sql_exception: Expression #1 of SELECT list
is not in GROUP BY clause and contains nonaggregated column
'db_rtmf.local.registered_apps.acc_id' which is not functionally
dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by in /Users/stevenjoiner/Sites/
rtmf_root_151122/webassist/mysqli/rsobj.php:221 Stack trace: #0 /Users/
stevenjoiner/Sites/rtmf_root_151122/webassist/mysqli/rsobj.php(221):
mysqli->query('SELECT SQL_CALC...') #1 /Users/stevenjoiner/Sites/
rtmf_root_151122/admin/index.php(38): WA_MySQLi_RS->execute() #2
{main} thrown in /Users/stevenjoiner/Sites/rtmf_root_151122/
webassist/mysqli/rsobj.php on line 221

It explains why it would work on one server and not another. There is a database setting preventing the SQL statement you are running. You can probably just update that setting if you have control of the server, or update the SQL statement to be compatible with that setting and it would still work on both.

Sign in to reply to this post
Did this help? Tips are appreciated...

s.joiner74419001

HI Ray, Really hope surgery went well for you. Not sure if and when your back working so ill just pose my question and look forward to hearing from you soon.
Basically just simply would like some guidance on how/what and where I would update the database setting for this to work. Its a bit beyond my scope.

Best regards
Steve

Sign in to reply to this post

s.joiner74419001

Just to update this feed as I have managed to resolve the issue using ChatGPT ,Bard and Stack overflow.

I had to adjust the my.cnf file located here:

TOP MENU - file/open template/MySQL(my.cnf)/5.7.39

The in the file add the line - sql_mode="" .. to the [mysqld] section as follows

# The MySQL server
[mysqld]
sql_mode=""
user = MAMP_system_user_MAMP
#port = 9999
socket = /Applications/MAMP/tmp/mysql/mysql.sock

My SQL Query in #1 post above now works!

Sign in to reply to this post

anonymous

Joe Lie

Hi Ray, I hope your treatment is going well. Regarding the query issue, it's interesting that it works on the remote server but fails with a 500 error on the local server, even though you've set the PHP version the same on both. It seems like a specific case that requires further investigation. By comparing the screenshots of the phpMyAdmin settings for both servers, you might be able to identify any discrepancies that could be causing the local failure. It could potentially be related to a value engineering case study that examines the differences between the servers and helps uncover the root cause. Good luck with resolving the issue!

Sign in to reply to this post

Ray BorduinWebAssist

This is a database server setting and not a web server or version issue. Some database settings can be configured differently on different servers.

Sign in to reply to this post
Did this help? Tips are appreciated...

anonymous

critical essay writing help

This post has been deleted.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...