The thing is I have a cronjob that repeats itself every 2min & calls a php script which does some mysql query.. now that thing is making mysql very busy which in the process is consuming too much …
Tag: mysql
Docker PHP MySQL connection refused
I am trying to run a site using multiple container configuration – one for apache, second for mysql and third for myadmin. Everything starts fine, setup runs smooth but when I try to run a PHP application I get mysqli::__construct(): (HY000/2002): Connection refused in system/libraries/drivers/Database/…
Getting rank of row in OrderBy desc Eloquent query, How can i make this query work in laravel 5.5 eloquents?)
I am trying to give my users a ranking number for my Laravel hiscores pagination table. This is the MySQL query I found working. I am trying to put make this work as a Laravel eloquent query. My Laravel eloquent query right now: Answer This is my solution. I first added this function to my User Modal Class. N…
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘payments’ already exists (SQL: create table `payments`
When I migrate a table I see this error, SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘payments’ already exists (SQL: create table payments Error Answer If you want to recreate the table, run php migrate:rollback first to delete the existing one. This command will run the down() …
Unique page for each row in database with PHP
I have been trying to create a unique page for each row in my database. My plan is to create a dictionary.php?word=title url, where I can display the description and title of that specific ID. My datbase is contains id, term_title and term_description. I’m fresh outta the owen when it comes to PHP, but …
Laravel Cannot delete or update a parent row: a foreign key constraint fails
For some reason a user cannot delete a post if it has been liked, it was working before but when I linked posts with likes I have been getting this error, I can’t even delete it in Sequel Pro, unless I delete the likes associated with the post first. Error SQLSTATE[23000]: Integrity constraint violation…
Concept of a SaaS system
Good evening, I developed a system that behaves in the SaaS format, where the client only registers and already has access to use, in it I used a unique identifier for each client and they all use the same structure, PHP files and the same database . So far so good, because the domain does not change, that is…
Laravel eloquent withCount() supposed to be slower than just with()
So the reason i ask this is that in my current app withCount() almost triples the response time vs just fetching all the data for the relationship via with() and just getting the length from the frontend (javascript). I thought the point of using withCount() was to speed up the query but maybe i’m wrong…
Can read Data from mysql database but cant write data into the database Using PHP 5.6 on Ubuntu 16.04?
I have a PHP 5.6 project, when I run it on localhost in windows/xampp it works perfectly fine.But when I use it in ubuntu/apache it connects to the db,reads data from the db perfectly but doesnt write …
Laravel: What is the purpose of the `loadMissing` function?
The first sentence of the Eager Loading section from the Laravel docs is: When accessing Eloquent relationships as properties, the relationship data is “lazy loaded”. This means the relationship …