| @@ 126-138 (lines=13) @@ | ||
| 123 | ||
| 124 | $this->validate($data); |
|
| 125 | ||
| 126 | if (empty($this->errors)) |
|
| 127 | { |
|
| 128 | // Insert the ad data to the database |
|
| 129 | $sql = 'INSERT INTO ' . $this->ads_table . ' ' . $this->db->sql_build_array('INSERT', $data); |
|
| 130 | $this->db->sql_query($sql); |
|
| 131 | ||
| 132 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 133 | } |
|
| 134 | else |
|
| 135 | { |
|
| 136 | $this->assign_errors(); |
|
| 137 | $this->assign_form_data($data); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||
| 141 | // Set output vars for display in the template |
|
| @@ 166-179 (lines=14) @@ | ||
| 163 | ||
| 164 | $this->validate($data); |
|
| 165 | ||
| 166 | if (empty($this->errors)) |
|
| 167 | { |
|
| 168 | // Insert the ad data to the database |
|
| 169 | $sql = 'UPDATE ' . $this->ads_table . ' |
|
| 170 | SET ' . $this->db->sql_build_array('UPDATE', $data) . ' |
|
| 171 | WHERE ad_id = ' . (int) $ad_id; |
|
| 172 | $this->db->sql_query($sql); |
|
| 173 | ||
| 174 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 175 | } |
|
| 176 | else |
|
| 177 | { |
|
| 178 | $this->assign_errors(); |
|
| 179 | } |
|
| 180 | } |
|
| 181 | else |
|
| 182 | { |
|