Skip to content

Tag: mysql

Laravel Join If Column Value Not Null

I try this method. I want to select discount if withCode value False. I try in where clause but in this method, if not false; I can’t access product. I want to select discount if withCode table FALSE. Else, I don’t want to select it Answer I solved with this codes;

SQL query JSON of MySQL 8.0 comes String instead of Array

I create a table in MySQL 8.0 as follows: It contains JSON type data, and I insert some data as: And I use php to visit the database, I wish to get value of “airline” as an Array. But it comes out a String, NOT an Array! This really annoys me, and JSON in MySQL is hard to understand. Answer

Filled many Textbox with Select box using laravel

I want to display data in a text box based on the selected options. for example if If I select the title of the book, it will display the author of the book, the price of the book, the year the book was printed. I want to display the book based on the selected option chosen my Controller my Model

Best way to run a SQL query for different dates

I have a PHP application that records the sessions of various devices connected to a server. The database has a table session, with the columns device_id, start_date, end_date. To know the number of devices connected on a given date, I can use the request : where :date is passed as a parameter to the prepared…