sprintf() 函数把格式化的字符串写入变量中。

  •     %s - 字符串
  • %d - 包含正负号的十进制数(负数、0、正数)

      $dao_loan = new Dao_V02_LoanModel();

      $f_sql  = sprintf('SELECT COUNT(id) AS total FROM %s ', $dao_loan->getTableName());

        $f_sql .= sprintf('WHERE rate = %d AND state = 6 ', $rate);
   
        $row = $dao_loan->fetch($f_sql);
        if (is_array($row) && count($row) > 0) {
            $loan_cntr[$loan_type] = (int)$row[0]['total'];
        }

你可能感兴趣的:(mysql)