Exemplo n.º 1
0
 function makePromoCodes($num = 10, $exp_date = 3)
 {
     $code_exp_date = time() + 86400 * $exp_date;
     $pr = new PlaceOrder();
     for ($i = 0; $i <= $num; $i++) {
         $code = $pr->generateRandomString();
         $query = "insert into mdl_promo_code " . "(code,active,expire_date) " . "values ('" . $code . "',\n                               '1', \n                               '" . $code_exp_date . "')";
         echo "Query: " . $query . "<br/>";
         $this->db->query($query);
     }
 }