public static function RecordExist($tableName, $obj) { $PDO_Obj = self::getPdoObject(); /*@var $PDO_Obj PDO*/ //------------------- $Arr = self::GetObjectMembers($obj, "update"); if ($Arr === false) { return false; } $KeyArr = array_keys($Arr); $where = "1=1"; for ($i = 0; $i < count($KeyArr); $i++) { $st = $Arr[$KeyArr[$i]]; if ($st === PDONULL || $st === "") { $where .= " AND " . $KeyArr[$i] . " is null"; } else { if ($st === PDONOW) { $where .= " AND " . $KeyArr[$i] . "=" . PDONOW; } else { $where .= " AND " . $KeyArr[$i] . "=:fld" . ($i < 10 ? "0" . $i : $i); } } } $mainQuery = "select * from " . $tableName . " where " . $where; $statement = $PDO_Obj->prepare($mainQuery); for ($i = 0; $i < count($KeyArr); $i++) { $st = $Arr[$KeyArr[$i]]; if ($st !== PDONULL && $st !== "" && $st !== PDONOW) { $statement->bindParam(":fld" . ($i < 10 ? "0" . $i : $i), self::CorrectFarsiString($st)); $mainQuery = str_replace(":fld" . ($i < 10 ? "0" . $i : $i), "'" . self::CorrectFarsiString($st) . "'", $mainQuery); } } //............................. $startTime = microtime(true); $statement->execute(); $endTime = microtime(true); self::$executionTime = $endTime - $startTime; self::$statements[$PDO_Obj->getAttribute(PDO::ATTR_CONNECTION_STATUS)] = $statement; self::$queryString = $mainQuery; self::LogQueryToDB(); //............................. if ($statement->errorCode() == "00000") { return $statement->rowCount() != 0; } parent::PushException($statement->errorInfo()); return false; }