If I execute the following query in Workbench, I get back the expected number of rows — 5. However if I enter the same user_id in the search field of my web app it returns ALL orders, whether or not it has been refunded, but still lists the total number of refunds as 5. Any help is appreciated. Answer B…
Tag: mysql
PHP query first shuffle their data by USER IDs, then shuffle the rest of the data
I will list sample blog posts. There are editors who write these blog posts. I am listing these blog posts randomly. I want the blog posts belonging to the ids of the editors in the $onlineeditor directory to be sorted randomly first, and then the blog posts that do not have the editors id in $onlineeditor to…
Laravel Many to Many Relationship mixes up id’s in insert
I got the the problem, that the id’s of the FK’s for my pivot table get mixed up before insert and thus I get an error because a category with an ID that high isn’t available. Here’s how I try to insert: The Advertisement migration and class function: And here the category class functi…
How can I install Atta?
I’ve already install XAMPP and composer. My XAMPP is 7.4 and my composer is using composer 1. I’m not yet upgrading to composer v2. How can I install this project on my computer? The project seems to be located at https://github.com/erleiuat/Atta. Answer Steps to be done: Open git bash or terminal…
Select a record when the timestamp has passed by a certain amount of time MYSQL/PHP
I’m trying to select sessions that are younger than 6 hours old with this query like so: The problem is that the query condition is always false and never manages to find the sessions even when a record actually has a timeStamp of a few seconds ago. obviously I am very sure that the problem is in the co…
Order mySQL query by year with several year specifications
I am using this query to pull out article entries from my database: With single year specifications, the query orders the entries by year as intended: Problematic is that this older database uses several publishing years in the same table cell, looking like this: Example: 1970, 1974, 1983 or sometimes with se…
How to insert values for the current session user using $stmt = $connect->prepare
This is my current code for adding some additional information to a database table named klantinfo. This information is added after the user is logged in. At the login, the given username gets inserted into the login table, but also into the klantinfo table. This way I can compare the username in the database…
Multiple Tables Search, with Limit Clause and Known Result Source Table Names
A situation arose where I have to heuristically find out a table name from a common id. The tables have the same exact structure so I thought union or union all will work as suggested by some answers here. The problem is, applying a limit clause to the query is not working well. If I apply it on more than
docker-compose, WordPress and MariaDB, PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused
I have a WP project with following docker-compose configuration. When I try to connect my http://localhost to access the installation, I get 500 and I read this in the log: PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/www/html/web/wp/wp-includes/wp-db.php I assume there is someth…
Flagging last overall row in MySQL query using LIMIT
I am retrieving results from a database in batches of 5, each time taking the last ‘id’ and returning it via jquery so only rows with smaller ‘id’ are returned. I have a load more button which should disappear after all rows are loaded, even if that means 5, 7 or 11 rows. I have this q…