|
@@ 130-136 (lines=7) @@
|
| 127 |
|
* @param array $ad_id ID of an ad to increment clicks |
| 128 |
|
* @return void |
| 129 |
|
*/ |
| 130 |
|
public function increment_ad_clicks($ad_id) |
| 131 |
|
{ |
| 132 |
|
$sql = 'UPDATE ' . $this->ads_table . ' |
| 133 |
|
SET ad_clicks = ad_clicks + 1 |
| 134 |
|
WHERE ad_id = ' . (int) $ad_id; |
| 135 |
|
$result = $this->db->sql_query($sql); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
/** |
| 139 |
|
* Insert new advertisement to the database |
|
@@ 179-186 (lines=8) @@
|
| 176 |
|
* @param int $ad_id Advertisement ID |
| 177 |
|
* @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
| 178 |
|
*/ |
| 179 |
|
public function delete_ad($ad_id) |
| 180 |
|
{ |
| 181 |
|
$sql = 'DELETE FROM ' . $this->ads_table . ' |
| 182 |
|
WHERE ad_id = ' . (int) $ad_id; |
| 183 |
|
$this->db->sql_query($sql); |
| 184 |
|
|
| 185 |
|
return $this->db->sql_affectedrows(); |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
/** |
| 189 |
|
* Get all locations for specified advertisement |