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.
Tag: sql
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
How to update a table with a foreach without overwriting?
So i’m working on a university project but i have a problem that’s really starting to bother me. I am trying to update my database several times with different values, except that only the last value will be taken into account : they’re overwriting themselves. My code : And my SQL method is like this : So for example if
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
How to send data in another page with a foreach loop and specific ID?
i have the follow code in PHP and HTML: And the JavaScript used in the button: In the beginning I am receiving the option of “Service 1” through a checkbox to proceed with the script I showed above, the problem arises when I want to select an ID from the 3 that are shown to generate a report in FPDF,
How to get multidimensional array grouped by multiple columns in PHP from single MySQL table?
I have table called “guids” that looks like this: From that I would like to get data in this format: Basically, I need to use multiple columns to build a nested array with grouped data. I know that I can achive that structure using foreach loop like this: But if possible I would like a more optimized solution on 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 |
Recount SQL auto increment ID while keeping the other columns intact
I have a table like this ID NAME 1 MICHAEL 2 JORDAN 5 DONALD 7 JAYCE 8 ROY 11 JOHN 16 DOE Is there a way to recount the ID from the beggining so there is a sequel and keeping the others columns intact to be like this: ID NAME 1 MICHAEL 2 JORDAN 3 DONALD 4 JAYCE 5 ROY