php 將mssql資料匯入到dedecms完整版

來源:互聯網
上載者:User

 $link = mssql_connect("127.0.0.1", "sa", "sa") or die("Can't connect sql server");
    mssql_select_db("cheng", $link) or die("Select database failure");
  
 mysql教程_connect('localhost','root','root') or die('資料庫教程伺服器不能串連');
 mysql_select_db('loupan') or die( 'error' );
 mysql_query("set Names 'gb2312'");
 $ms_sql ="Select * from sony_z2800";
 $ms_query = mssql_query( $ms_sql ) or die('55555');
 $typeid =23;
 $write ='';
 $sj ='';
 $sjzt ='';
 while( $ms_rs = mssql_fetch_array( $ms_query ) )
 {
  $filetype = $ms_rs[8];
  $language = $ms_rs[6];
  $os = $ms_rs[10];
  $softsize = $ms_rs[7];
  $softlinks = mysql_escape_string("{dede:link islocal='1' text='迅雷下載'}".$ms_rs[11]."{/dede:link}");
  $title = mysql_escape_string(mb_convert_encoding($ms_rs[3],'gbk','gb2312'));
  $click = $ms_rs[9];
  if( !is_numeric($click))
  {
   $click = mt_rand(100,1000);
  }
  $litpic = mysql_escape_string(str_replace('"  />','',str_replace('  <img src="','',$ms_rs[12]))); 
  $desciption ="";
  $introduce='';

  //die($desciption);
   
  $addsoft = "Insert into 3g_addonsoft(typeid,filetype,language,softtype,accredit,

os,softrank,officialUrl,officialDemo,softsize,softlinks,introduce,templet,userip,redirecturl)";
   $addsoft .=" values

('$typeid','$filetype','$language','','','$os','3','','','$softsize','".$softlinks."','$introduce','','202.103.69.94','')";
   mysql_query( $addsoft ) or die('addsoft'.$addsoft.mysql_error());
   $newid = mysql_insert_id();
  
   $temp_title = $title.'-'.$sj.'-'.$language;
   $seo =$os.$sj.$sjzt;
   keywords= $os.','.$sj.','.$sjzt.','.$title.','.$language
  
   $archives = "Insert into 3g_archives

(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,litpic,writer,source,pubdate,senddate,mid,dutyadmin

,description,keywords)";  
   $archives.=" values

('$newid','$typeid','0','1255070897','p','1','3','0','$click','0','$temp_title','$litpic','$write','未

知','1255070897','1255070970',1,1,'$desciption','$keywords')";
  
   mysql_query($archives) or die('archives '.$temp_title.'|'.$archives.mysql_error());
   $arctiny = "Insert into 3g_arctiny(id,typeid,typeid2,arcrank,channel,senddate,sortrank,mid) values

($newid,$typeid,0,0,3,'1255070897','1255070970',1)";
  
   mysql_query( $arctiny) or die( 'arctiny'.$arctiny.mysql_error());
  
 } 
 echo 'success'; 

本站原創轉載註明來源.net教程">www.111cn.net

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.