skip to Main Content

I have a table with these columns in a Mysql database;

tlid
uid
did
mail
mailed
maileddate
phone
driveup
taxdeed
taxcertificateoneyear
taxcertificatetwoyears
delinquenttaxes
preforeclosure
realestateowned
qualified
trackdate
created_at
updated_at

Whenever I try to add another column, a query that uses a left join to pull data form this table causes a 500 Internal server error.

When I remove the table added the site would start working again. The column I added was not a reserved keyword, tried several different words but same error.The site is hosted on Godaddy

This is the query;
$pageData['allleads'] = DB::table('deals')->where('deals.category', 'lead')->where('deals.uid', '2')->where('deals.active', '1')->where('deals.locked', '0')->leftJoin('track_leads', 'track_leads.did', '=', 'deals.id')->leftJoin('lead_progressions', 'lead_progressions.did', '=', 'deals.id')->groupBy('id')->get();

2

Answers


  1. Chosen as BEST ANSWER

    I was able to resolve the issue. It turns out an error was logged from PHP in the public folder which is the root.

    [06-Jun-2022 00:12:56 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 19212392 bytes) in /home/home-site/public_html/mysite/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php on line 63

    So I increased the memory_limit from 128Mb to 512Mb in a .user.ini file.(I take it this could have been adjusted in php.ini also)

    I was loading 18,738 records to a datatable so my next move is to implement Ajax to lazy load a smaller amount of records.


  2. in your case i will recommend you to do a next thing:

    1. Instead of composing query on eloquent level – firstly do that on sql level. To actually debug the problem you can follow next approach:
    DB::table('deals')->where('deals.category', 'lead')->where('deals.uid', '2')->where('deals.active', '1')->where('deals.locked', '0')->leftJoin('track_leads', 'track_leads.did', '=', 'deals.id')->leftJoin('lead_progressions', 'lead_progressions.did', '=', 'deals.id')->groupBy('id')->dd();
    

    The output will be formatted to SQL, and you can copy/paste it to actual SQL server and execute the query there, there is a big chance, that the problem in SQL syntax.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search