用explode()拆分数组,打印下结果该判断的判断,该替换的替换

解决方案 »

  1.   

    update tablename set url=replace(url,'A/', ' uploads/') where url like '%img%';
    update tablename set url=replace(url,'A/', ' uploads/') where id not in( select id fromt tablename where url like '%img%');
    希望我的回答对你有帮助,谢谢。
      

  2.   


    SELECT  REPLACE(url, 'A/', 'upload/') FROM $TABLE WHERE url LIKE '%img%';SELECT  REPLACE(url, 'A/', 'upload/') FROM $TABLE WHERE url NOT LIKE '%img%'另外可以看看 MySQL的REGEXP 关键字PHP实战QQ群:  33918040
      

  3.   

    做任何事情都不能想当然
    SELECT  REPLACE('A/A/A/xxx', 'A/', 'upload/')upload/upload/upload/xxx
      

  4.   

    1、将url字段记录中包含有img字符串的数据查询出来,并且将记录中的 A/ 替换成 uploads/.
    2、将url字段记录中不包含有img字符串的数据查询出来,并且将记录中的 A/ 替换成 uploads/. 都是将 A/ 换成 upload/ 吗 ?直接select 'upload/'.substr(url,3,length(url)-2) from mytable 
      

  5.   

    SELECT  REPLACE(url, substr(url,0,2), 'upload/') FROM $TABLE WHERE url LIKE '%img%';SELECT  REPLACE(url, substr(url,0,2), 'upload/') FROM $TABLE WHERE url NOT LIKE '%img%'