Skip to content
Advertisement

Tag: sql

Resolve name by ID in from 2 tables in PHP / SQL in Datatable

I am currently working on my first datatable which I managed to get to work and I am quite happy with it, however I am having some difficulties in resolving client names. Here is my current code: Tablefile.html: And here my datatable.php file: The table renders fine and works great, however client_id is obviously just outputting their related ID’s, e.g.

retrieve rows based on parent relationship

This is the query: I am trying to get all the checklist items that have the same item_stock_id from the checklists that have the same ambulance_id. However, the query from above is not working, showing me this error: Below is the ChecklistItem model: And this is the Checklist model: Answer To constrain the eager load you need to specify the

How can I print this data in a HTML table with this format?

Imagine that you have this SQL query result: And you want to print a table taking into account the ID_KEY, like this: How can I do that? I want to print a new row when ID_KEY changes. For example, now I have this code: This code won’t work because “value1”, “value2” and “value3”, are fields that do not exist in

How to change a value between 2 words with IF() in Mysql?

I am trying to change a value between on / off in a table using this code: But it is not working correct and I get this error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near

Search through laravel relationship with filtered date

i search data 1 (this exist in database) within date range of 13-04-2022 to 14-04-2022 (there is no data in this date range). From this query that i used on my controller still return the data that contains a keyword that i search for (data 1). What i wanted is to return collection of data with the range of the

PHP Convert in date and update a database (PhpMyAdmin) with a date (like 22:43:50)

i don’t understand why i can’t update my DataBase with times like “21:20:46”. My table in PhpMyAdmin is in time unit. i already tried to update time differently like SET time = 212046 and it updated my table to 21:20:46 Answer FROM_UNIXTIME is amysql function that will work just fine | FROM_UNIXTIME(1647724846, ‘%h:%i:%s’) | | :———————————— | | 09:20:46 |

Advertisement