如何解决“ $ this-> db-> insert_batch($ this-> tbl,$ data)不显示任何错误,也不会插入DB”的问题?

时间:2019-05-23 05:12:28

标签: php sql codeigniter phpmyadmin codeigniter-2

我只是试图使用insert_batch(),但是它甚至也没有插入到我的表中,甚至没有显示错误。但是我确定控制流已经通过了insert_batch()函数。

我试图用''和null值在表格中包含所有可用字段,但仍然无法使用

   echo "<pre>";
   $this->agent_model->insert_batch($agents);
   $this->property_model->insert_batch($properties);
   die;

agent_model

    public function insert_batch($data) {
        print_r($data);//$this->tbl = agent
        return $this->db->insert_batch($this->tbl, $data);
    }

property_model

    public function insert_batch($data) {
        print_r($data);//$this->tbl = properties
        return $this->db->insert_batch($this->tbl, $data);
    }

我希望输出将批量插入值,但是输出很简单

Array
(
    [0] => Array
        (
            [agent_bio] => 
            [agent_address] => 
            [agent_email] => 
            [agent_twitter] => 
            [agent_facebook] => 
            [image] => 
            [agent_office_address] => 
            [created_at] => 
            [agent_code] => BB815843
            [agent_name] => Anthony Bruno
            [agent_phone] => (781) 710-4544
            [agent_office_code] => BB5918
            [agent_office_name] => Gibson Sotheby's International Realty
            [agent_office_phone] => (617) 426-6900
        )

)
Array
(
    [0] => Array
        (
            [id] => 
            [name] => 
            [bed] => 
            [vehicle] => 
            [bath] => 
            [rate] => 2500000.00
            [view_count] => 
            [source] => mls
            [type] => sell
            [msl_id] => 72485384
            [is_featured] => 
            [banner_image] => 
            [country_id] => 1
            [city] => Somerville, MA
            [street] => Beacon Street
            [zip_code] => 02143
            [is_beachfront] => No
            [area] => 
            [lat] => 
            [lon] => 
            [has_basement] => 
            [direction] => 294 Beacon Street is between Eustis Street and Sacramento Street
            [has_master_bath] => 
            [rooms] => 
            [property_type] => 
            [status] => ACT
            [taxes] => 0.00
            [tax_year] => 00
            [year_build] => 
            [list_date] => 04/22/2019
            [agent_id] => 
            [tags] => 
            [raw_data] => {"ACRE":"0.17","AMENITIES_LD":"Public Transportation, Shopping, Park, T-Station, University","BEACHFRONT_FLAG":"No","BUYER_BROKER_COMP":"2","CABLE_AVAILABLE_LD":"Yes","COMP_BASED_ON":"Net Sale Price","DIRECTION":"294 Beacon Street is between Eustis Street and Sacramento Street","DISCLOSURE":"No","DISCLOSURES":"See plans and environmental site assessment attached to MLS listing.","DOCUMENTS_ON_FILE_LD":"Other (See Remarks)","DPR_Flag":"No","ELECTRIC_FEATURE_LD":"On-Site","ENTRY_ONLY":"No","FIRM_RMK1":"See plans and environmental site assessment attached to MLS listing.","GAS_LD":"On-Site","HOW_SHOWN_BB":"Call List Agent, Accompanied Showings, Appointment Required","HOW_SHOWN_FB":"Call List Agent, Accompanied Showings, Appointment Required","LAND_DESC_LD":"Level","LD_TYPE_LD":"Residential","LENDER_OWNED":"No","LIST_AGENT":"BB815843","LIST_AGENT_NAME":"Anthony Bruno","LIST_AGENT_PHONE":"(781) 710-4544","LIST_DATE":"04\/22\/2019","LIST_DATE_RCVD":"4\/22\/2019 9:45:00 AM","LIST_OFFICE":"BB5918","LIST_OFFICE_NAME":"Gibson Sotheby's International Realty","LIST_OFFICE_PHONE":"(617) 426-6900","LIST_PRICE":"2500000.00","LISTING_AGREEMENT":"Exclusive Right to Sell","LIST_NO":"72485384","LOT_SIZE":"7535.00","MAIN_LO":"BB5918","MARKET_TIME":"28","MARKET_TIME_BROKER":"28","MARKET_TIME_PROPERTY":"28","ORIG_PRICE":"2500000.00","PHOTO_DATE":"4\/22\/2019 9:45:00 AM","PROP_TYPE":"LD","REMARKS":"Fully approved! This is your chance to purchase one of the last buildable lots on Beacon Street in Somerville. Ideally located on the Somerville\/Cambridge line just a short walk to the MBTA Red Line at Porter Square and in close proximity to both Harvard Square and Inman Square. Current plans call for the following: 7 parking spaces (6 garage, 1 outdoor), 5 units total. Unit breakdown as follows: 2 two level townhouse style units, 1,800 sq\/ft each, 2 bed\/2.5 bath. 2 one bedroom units, 900 sq\/ft each,1 bed\/1 or 1.5 bath, 1 penthouse unit, 1,600 sq\/ft (attached plans list this unit at 1,344 sq\/ft, but the seller is increasing the living space), 2 bed\/2.5 bath with private 30x8 (240 sq\/ft) balcony. 1,000 sq\/ft common outdoor space (garden\/patio). Gas and electric already on site about 20 feet away. Sewer already on site about 30 feet away. 5 inch fire line and 2 inch cold water line not on site.","ROAD_TYPE_LD":"Public, Paved, Publicly Maint., Sidewalk","SEWER_LD":"Public, On-Site","SHORT_SALE_LENDER_APP_REQD":"No","SHOW_INSTRUCTION":"Contact Anthony Bruno at 781 710 4544 or a.bruno@gibsonsir.com","STATUS":"ACT","STATUS_DATE":"4\/22\/2019 9:45:00 AM","STREET_NAME":"Beacon Street","STREET_NUM":"294","TAX_YEAR":"00","TAXES":"0.00","TOWN":"Somerville, MA","UPDATE_DATE":"4\/26\/2019 3:05:00 AM","WATER_LD":"At Street","WATERFRONT_FLAG":"No","WATERVIEW_FLAG":"No","ZIP_CODE":"02143","ZONE_USAGE_LD":"Other (See Remarks)","ZONING":"RC"}
            [created_at] => 
            [description] => Fully approved! This is your chance to purchase one of the last buildable lots on Beacon Street in Somerville. Ideally located on the Somerville/Cambridge line just a short walk to the MBTA Red Line at Porter Square and in close proximity to both Harvard Square and Inman Square. Current plans call for the following: 7 parking spaces (6 garage, 1 outdoor), 5 units total. Unit breakdown as follows: 2 two level townhouse style units, 1,800 sq/ft each, 2 bed/2.5 bath. 2 one bedroom units, 900 sq/ft each,1 bed/1 or 1.5 bath, 1 penthouse unit, 1,600 sq/ft (attached plans list this unit at 1,344 sq/ft, but the seller is increasing the living space), 2 bed/2.5 bath with private 30x8 (240 sq/ft) balcony. 1,000 sq/ft common outdoor space (garden/patio). Gas and electric already on site about 20 feet away. Sewer already on site about 30 feet away. 5 inch fire line and 2 inch cold water line not on site.
        )

)

2 个答案:

答案 0 :(得分:0)

尝试此操作并检查您的查询...特别选中此行-“吉布森·苏富比国际房地产”

$this->agent_model->insert_batch($agents);echo $this->db->last_query().'<br/><br/>';
   $this->property_model->insert_batch($properties); echo $this->db->last_query().'<br/><br/>';

答案 1 :(得分:0)

谢谢您的帮助。 我解决了这个问题 addOnItemTouchListener(new OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) { if (motionEvent.getAction() == MotionEvent.ACTION_DOWN && recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_SETTLING){ recyclerView.stopScroll(); } return false; } @Override public void onTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean b) { } }); 正在函数的某处使用,并且 我在$this->db->trans_start();之前使用die() 对不起,傻事