欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

璇诲彇ACCESS鏁版嵁鍒癕YSQL鐨凱HP浠g爜 - PHP鍏ラ棬

程序员文章站 2022-06-11 12:30:39
...
涓嬮潰瀹炰緥姣旇緝绠€鍗?灏辨槸鍏堝埄鐢╟om鎺ュ彛璇诲彇access鏁版嵁搴?鎶婃暟鎹鍙栧悗鍐嶈繛鎺ysql鏁欑▼鏁版嵁搴?鎶婂搴旂殑瀛楁insert鍒癿ysql瀵瑰簲鐨勮〃涓庡瓧娈靛氨瀹炵幇浜?璇诲彇ACCESS鏁版嵁鍒癕YSQL鐨凱HP浠g爜濡備笅:
Open($connstr); 
	 $rs =  new COM("ADODB.RecordSet"); 
	//寮€婧愪唬鐮乸hprm.com 
	 $rs->Open("select * from News where bigclassname='瑁呬慨璇惧爞'",$conn,1,3); 
	 while(!$rs->eof){ 
	     switch ($rs->Fields[4]){ 
	      case "瑁呬慨椤鹃棶": 
	      $sclass=1; 
	      break; 
	      case "鍘ㄥ崼绌洪棿": 
	      $sclass=2; 
	      break; 
	      case "瀹跺叿鐗╄": 
	      $sclass=3; 
	      break; 
	      case "鐢靛櫒宸ョ▼": 
	      $sclass=4; 
	      break; 
	      case "灞呴グ椋庢櫙": 
	      $sclass=5; 
	      break; 
	      case "鏉愭枡骞胯": 
	      $sclass=6; 
	      break; 
	      default: 
	      $sclass=1; 
	     } 
	     if ($rs->Fields[6]){ 
	      $spic=""; 
	     }else{ 
	      $spic=$rs->Fields[6]; 
	     } 
	     if ($rs->Fields[7]){ 
	      $user=""; 
	     }else{ 
	      $user=$rs->Fields[7]; 
	     } 
	     if ($rs->Fields[9]){ 
	      $hits=1; 
	     }else{ 
	      $hits=$rs->Fields[9]; 
	     } 
	     $sql="insert into rc_news(n_title,n_content,n_bclass,n_sclass,n_pic,n_spic,n_user,n_hits,n_audit) values('".$rs->Fields[1]."','".$rs->Fields[2]."',1,".$sclass.",'','".$spic."','".$user."',".$hits.",1)"; 
	     $result=mysql _query($sql); 
	     //echo  $rs->Fields[1]; 
	     //echo "
"; $rs->Movenext(); //灏嗚褰曢泦鎸囬拡涓嬬Щ } $rs->close();

鏈枃鍦板潃锛?a target="_self" data-cid="10425" href="">

杞浇闅忔剰锛屼絾璇烽檮涓婃枃绔犲湴鍧€:-)