  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: reviews.php 184 2005-09-07 14:48:20Z hpdl $ |
| |
| 3 | + | $Id: reviews.php 210 2005-10-04 05:47:42Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
88 | 88 | | break; |
| |
89 | 89 | | } |
| |
90 | 90 | | } |
  |
| 91 | + | |
| |
| 92 | + | function getTotal($id) { |
| |
| 93 | + | global $osC_Database; |
| |
| 94 | + | |
| |
| 95 | + | $Qcheck = $osC_Database->query('select count(*) as total from :table_reviews where products_id = :products_id and languages_id = :languages_id and reviews_status = 1 limit 1'); |
| |
| 96 | + | $Qcheck->bindTable(':table_reviews', TABLE_REVIEWS); |
| |
| 97 | + | $Qcheck->bindInt(':products_id', $id); |
| |
| 98 | + | $Qcheck->bindInt(':languages_id', $_SESSION['languages_id']); |
| |
| 99 | + | $Qcheck->execute(); |
| |
| 100 | + | |
| |
| 101 | + | return $Qcheck->valueInt('total'); |
| |
| 102 | + | } |
| |
| 103 | + | |
| |
| 104 | + | function exists($id) { |
| |
| 105 | + | global $osC_Database; |
| |
| 106 | + | |
| |
| 107 | + | $Qcheck = $osC_Database->query('select reviews_id from :table_reviews where products_id = :products_id and languages_id = :languages_id and reviews_status = 1 limit 1'); |
| |
| 108 | + | $Qcheck->bindTable(':table_reviews', TABLE_REVIEWS); |
| |
| 109 | + | $Qcheck->bindInt(':products_id', $id); |
| |
| 110 | + | $Qcheck->bindInt(':languages_id', $_SESSION['languages_id']); |
| |
| 111 | + | $Qcheck->execute(); |
| |
| 112 | + | |
| |
| 113 | + | if ($Qcheck->numberOfRows() === 1) { |
| |
| 114 | + | return true; |
| |
| 115 | + | } |
| |
| 116 | + | |
| |
| 117 | + | return false; |
| |
| 118 | + | } |
  |
91 | 119 | | } |
| |
92 | 120 | | ?> |