| @@ 151-163 (lines=13) @@ | ||
| 148 | ||
| 149 | $this->validate($data); |
|
| 150 | ||
| 151 | if (empty($this->errors)) |
|
| 152 | { |
|
| 153 | // Insert the ad data to the database |
|
| 154 | $sql = 'INSERT INTO ' . $this->ads_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 155 | $this->db->sql_query($sql); |
|
| 156 | ||
| 157 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 158 | } |
|
| 159 | else |
|
| 160 | { |
|
| 161 | $this->assign_errors(); |
|
| 162 | $this->assign_form_data($data); |
|
| 163 | } |
|
| 164 | } |
|
| 165 | ||
| 166 | // Set output vars for display in the template |
|
| @@ 191-204 (lines=14) @@ | ||
| 188 | ||
| 189 | $this->validate($data); |
|
| 190 | ||
| 191 | if (empty($this->errors)) |
|
| 192 | { |
|
| 193 | // Insert the ad data to the database |
|
| 194 | $sql = 'UPDATE ' . $this->ads_table . ' |
|
| 195 | SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
| 196 | WHERE ad_id = ' . (int) $ad_id; |
|
| 197 | $this->db->sql_query($sql); |
|
| 198 | ||
| 199 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 200 | } |
|
| 201 | else |
|
| 202 | { |
|
| 203 | $this->assign_errors(); |
|
| 204 | } |
|
| 205 | } |
|
| 206 | else |
|
| 207 | { |
|