Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $updatQuery = $this->dbh->prepare($query);
- $paramsUTF8 = array_map('utf8_decode', array_values($paramsForQuery)); // I have french characters, that's why
- $count = 1;
- foreach ($paramsUTF8 as $p) {
- $typeBind = \PDO::PARAM_STR;
- $typeBindString = 'string'; // used for displaying the log
- if (strtolower($p) == 'null') {
- $typeBind = \PDO::PARAM_NULL;
- $typeBindString = 'null';
- }
- else if (is_int($p)) {
- $typeBind = \PDO::PARAM_INT;
- $typeBindString = 'int';
- }
- else if (is_string($p)) {
- $typeBind = \PDO::PARAM_STR;
- $typeBindString = 'string';
- }
- $this->logger->logThis('BIND [' . $count . '] ==> ' . $p . ' [typeBind : ' . $typeBindString . ']');
- $updatQuery->bindValue($count, $p, $typeBind);
- $count++;
- }
- if ($updatQuery->execute()) {
- $this->logger->logThis('OK - it's working');
- return true;
- }
- else {
- $this->logger->logThis("F*** this! I'm going home!");
- }
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement