I am building a Trello style board with PHP and MySQL shown in the screenshot image below.
Each of my column/boards comes from a database record.
SELECT * FROM `order_status` ORDER BY `sort_order` ASC
With the result of my MySQL query from my order_status
table, I will loop over it to create each Board/Column in the KanBan board.
I have a 2nd MySQL query that will get all mcards
that will go on to the board columns.
My image below shows a board column for Backlog and In-Progress so when I get my card records, I need to print them out to screen under the correct board columns that match up with the board names.
The MySQL query to get my record might look like this...
SELECT * FROM `board_cards` ORDER BY `modified_date` ASC
So from my board_cards
result there is a board
column which will have a value that matches up with one of the board names.
How would I go about printing the cars under each board column?
About how that might look (not real code)
$boardColumnNames = 'SELECT * FROM `order_status` ORDER BY `sort_order` ASC'
while($boardColumnNames){
// loop over each board column and print out all the board card records that belong on each board column
}
Can someone help be with how that PHP might look considering I have the board names in a variable and the board cards in a variable and each board card has a board value that will tell which board it belongs under?
Would it be best to get all my board card records and loop over them, putting all cards for each board into it;s own array variable. After that while looping over to build each board/column I could loop over the array that belongs to that board.
OR
Would it be better to instead use some sort of JOIN in my database result to do it all at once somehow?