| @@ 439-477 (lines=39) @@ | ||
| 436 | * @param bool $forceQuery |
|
| 437 | * @return bool true if update is succesful, false if unsuccesful |
|
| 438 | */ |
|
| 439 | public function updateGmap($obj, $forceQuery = false) |
|
| 440 | { |
|
| 441 | $tablename = 'efqdiralpha1_gmaps'; |
|
| 442 | $keyName = 'id'; |
|
| 443 | if ($obj instanceof efqGmap) { |
|
| 444 | // Variable part of this function ends. From this line you can copy |
|
| 445 | // this function for similar object handling functions. |
|
| 446 | $obj->cleanVars(); |
|
| 447 | $cleanvars = $obj->cleanVars; |
|
| 448 | $keyValue = $obj->getVar($keyName); |
|
| 449 | } else { |
|
| 450 | return false; |
|
| 451 | } |
|
| 452 | $countVars = count($cleanvars); |
|
| 453 | $i = 1; |
|
| 454 | $strSet = ''; |
|
| 455 | $strValues = ''; |
|
| 456 | foreach ($cleanvars as $k => $v) { |
|
| 457 | if ($k !== 'id') { |
|
| 458 | $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 459 | if ($i < $countVars) { |
|
| 460 | $strSet .= ', '; |
|
| 461 | } |
|
| 462 | } |
|
| 463 | $i++; |
|
| 464 | } |
|
| 465 | $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 466 | if ($forceQuery) { |
|
| 467 | if ($this->db->queryF($sql)) { |
|
| 468 | return true; |
|
| 469 | } |
|
| 470 | } else { |
|
| 471 | if ($this->db->query($sql)) { |
|
| 472 | return true; |
|
| 473 | } |
|
| 474 | } |
|
| 475 | ||
| 476 | return false; |
|
| 477 | } |
|
| 478 | } |
|
| 479 | ||
| @@ 169-203 (lines=35) @@ | ||
| 166 | * @param bool $forceQuery |
|
| 167 | * @return bool true if update is successful, false if unsuccessful |
|
| 168 | */ |
|
| 169 | public function updateListingData($obj, $forceQuery = false) |
|
| 170 | { |
|
| 171 | $tablename = 'efqdiralpha1_data'; |
|
| 172 | $keyName = 'dataid'; |
|
| 173 | if ($obj instanceof efqListingData) { |
|
| 174 | // Variable part of this function ends. From this line you can copy |
|
| 175 | // this function for similar object handling functions. |
|
| 176 | $obj->cleanVars(); |
|
| 177 | $cleanvars = $obj->cleanVars; |
|
| 178 | $keyValue = $obj->getVar($keyName); |
|
| 179 | } else { |
|
| 180 | return false; |
|
| 181 | } |
|
| 182 | $countVars = count($cleanvars); |
|
| 183 | $i = 1; |
|
| 184 | $strSet = ''; |
|
| 185 | $strValues = ''; |
|
| 186 | foreach ($cleanvars as $k => $v) { |
|
| 187 | $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 188 | if ($i < $countVars) { |
|
| 189 | $strSet .= ', '; |
|
| 190 | } |
|
| 191 | $i++; |
|
| 192 | } |
|
| 193 | $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 194 | if ($forceQuery) { |
|
| 195 | if ($this->db->queryF($sql)) { |
|
| 196 | return true; |
|
| 197 | } |
|
| 198 | } else { |
|
| 199 | if ($this->db->query($sql)) { |
|
| 200 | return true; |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||
| 204 | return false; |
|
| 205 | } |
|
| 206 | ||