数据库text字段存值用回车分隔

//查询
$sql = "SELECT attr_values FROM ecs_attribute WHERE attr_id=197";
    $param_sel_sms = array();
    $r_references = PdbcTemplate::query($sql,$param_sel_sms,PDO::FETCH_ASSOC,1);
    $a = explode("\r\n",$r_references['attr_values']);
    echo '<pre/>';
    print_r($a);
    print_r($r_references);
    var_dump($r_references);
    exit;

//增加
    $a = "自测13-11\r\n自测13-21\r\n自测13-31";
    $sql='UPDATE ecs_attribute SET attr_values="'.$a.'"WHERE attr_id=?';
    echo $sql;
    $param_sel_sms = array(197);
    $r_references = PdbcTemplate::execute($sql,$param_sel_sms);
    echo '<pre/>';
    print_r($r_references);
    exit;

 

posted on 2016-11-26 14:14  爱吃柠檬不加糖  阅读(456)  评论(0编辑  收藏  举报

导航