0

i have a little problem. I have made my own board and now I want to delete rows from multiple tables for removing boards and its included threads and posts. But my SQL query does not work. It delete only rows where are threads and posts. I need a query which also delete a board that doesn't have any threads and posts

Here is my query:

<?php
function removeBoard($boardID) {
    global $db;

    $sql = "DELETE FROM
                    boards,
                    board_threads,
                    board_posts
            USING
                boards
            INNER JOIN
                board_threads
            INNER JOIN
                board_posts
            WHERE
                boards.boardID = ". $boardID ." AND
                board_threads.boardID = boards.boardID AND
                board_posts.threadID = board_threads.threadID";

    $db->query($sql);
}
?>

I have this code from that post "delete rows from multiple tables" but I don't have the boardID column in my board_posts table only a threadID column.

Community
  • 1
  • 1
Skyxo
  • 23
  • 4

0 Answers0