|
@@ 607-620 (lines=14) @@
|
| 604 |
|
$command->execute(); |
| 605 |
|
} |
| 606 |
|
|
| 607 |
|
public function insertPostCategory($postID,$categoryID) |
| 608 |
|
{ |
| 609 |
|
$sql="INSERT INTO tblPost2Category (post_id, category_id) VALUES (?, ?)"; |
| 610 |
|
$command=$this->_db->createCommand($sql); |
| 611 |
|
$command->bindValue(1, $postID); |
| 612 |
|
$command->bindValue(2, $categoryID); |
| 613 |
|
$command->execute(); |
| 614 |
|
|
| 615 |
|
$sql="UPDATE tblCategories SET post_count=post_count+1 WHERE id=?"; |
| 616 |
|
$command=$this->_db->createCommand($sql); |
| 617 |
|
$command->bindValue(1, $categoryID); |
| 618 |
|
$command->execute(); |
| 619 |
|
|
| 620 |
|
} |
| 621 |
|
|
| 622 |
|
public function deletePostCategory($postID,$categoryID) |
| 623 |
|
{ |
|
@@ 622-637 (lines=16) @@
|
| 619 |
|
|
| 620 |
|
} |
| 621 |
|
|
| 622 |
|
public function deletePostCategory($postID,$categoryID) |
| 623 |
|
{ |
| 624 |
|
$sql="DELETE FROM tblPost2Category WHERE post_id=? AND category_id=?"; |
| 625 |
|
$command=$this->_db->createCommand($sql); |
| 626 |
|
$command->bindValue(1, $postID); |
| 627 |
|
$command->bindValue(2, $categoryID); |
| 628 |
|
$result=$command->query(); |
| 629 |
|
|
| 630 |
|
if($result->getRowCount()>0) |
| 631 |
|
{ |
| 632 |
|
$sql="UPDATE tblCategories SET post_count=post_count-1 WHERE id=?"; |
| 633 |
|
$command=$this->_db->createCommand($sql); |
| 634 |
|
$command->bindValue(1, $categoryID); |
| 635 |
|
$command->execute(); |
| 636 |
|
} |
| 637 |
|
} |
| 638 |
|
|
| 639 |
|
public function queryEarliestPostTime() |
| 640 |
|
{ |