Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- controller :
- function insert_brand() {
- if (empty($this->input->post())) {
- $content_header = new DVORE_admin_header_obj();
- $content_header->save_button = new stdClass();
- $content_header->save_button->target_form = "#add-brand";
- $page_data["content_header"] = $content_header;
- $page_data["page_name"] = "insert_test_data/brand";
- $this->load->view('admin', 'site/index', $page_data);
- }else{
- $post = $this->input->post();
- $this->{$this->model_name}->insert_test_brand($post);
- redirect(dvore_base_url("admin/brands/all"));
- }
- }
- model :
- function insert_test_brand($post){
- $nb_brand = $post["nb_brand"];
- if(is_numeric($nb_brand)){
- for($i = 0; $i < $nb_brand; $i++){
- $insert = [];
- $insert["name"] = "brand" . $i . "_test";
- $insert["user_added"] = 999999;
- $insert["date_added"] = date("Y-m-d H:i:s");
- $this->db->insert("VORE_SHOP_brands", $insert);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement