예제 #1
0
파일: index.php 프로젝트: Tekken3/test
            echo '<p>' . $row['post_content'] . '</p>';
            echo '<span>' . $row['post_date'] . '</span>';
            echo '</div>';
        }
        mysqli_close($cx);
    }
    public function insert($id, $title, $content, $date)
    {
        $q = mysqli_query($cx, "SELECT * FROM post WHERE post_id = " . $this->postId);
        $row = mysqli_fetch_assoc($q);
        mysqli_close($cx);
        return $row;
    }
    public function delete($id)
    {
        $cx = $this->connect();
        if (is_int($id)) {
            $query = "DELETE FROM post WHERE post_id = " . $id;
        } else {
            if (is_array($id)) {
                $ids = implode(', ', $id);
                $query = "DELETE FROM post WHERE post_id in ( " . $ids . " )";
            }
        }
        mysqli_query($cx, $query);
    }
}
$post = new post();
$post->delete(7);
$post->retrive();