Rumah > php教程 > php手册 > 璇诲彇ACCESS鏁版嵁鍒癕YSQL鐨凱HP浠g爜 - PHP鍏ラ棬

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

WBOY
Lepaskan: 2016-05-26 15:22:00
asal
1933 orang telah melayarinya

涓嬮潰瀹炰緥姣旇緝绠€鍗?灏辨槸鍏堝埄鐢╟om鎺ュ彛璇诲彇access鏁版嵁搴?鎶婃暟鎹鍙栧悗鍐嶈繛鎺ysql鏁欑▼鏁版嵁搴?鎶婂搴旂殑瀛楁insert鍒癿ysql瀵瑰簲鐨勮〃涓庡瓧娈靛氨瀹炵幇浜?璇诲彇ACCESS鏁版嵁鍒癕YSQL鐨凱HP浠g爜濡備笅:

<?php 
	header(&#39;ontent-Type:text/html;charset=GB2312&#39;);//閬垮厤杈撳嚭涔辩爜 
	$dbhost     ="localhost"; 
	$dbuser     ="root"; 
	$dbpassword = "123456"; 
	$dbname     = "139miaosha"; 
	mysql_connect($dbhost,$dbuser,$dbpassword) or die("error!"); 
	mysql_query("set names &#39;gbk&#39;"); 
	mysql_select_db(&#39;139miaosha&#39;); 
	 
	 
	 $conn = new com("ADODB.Connection"); 
	 $connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=F:/wamp/www/miaosha/ruichao858.mdb"; 
	 $conn->Open($connstr); 
	 $rs =  new COM("ADODB.RecordSet"); 
	//寮€婧愪唬鐮乸hprm.com 
	 $rs->Open("select * from News where bigclassname=&#39;瑁呬慨璇惧爞&#39;",$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(&#39;".$rs->Fields[1]."&#39;,&#39;".$rs->Fields[2]."&#39;,1,".$sclass.",&#39;&#39;,&#39;".$spic."&#39;,&#39;".$user."&#39;,".$hits.",1)"; 
	     $result=mysql _query($sql); 
	     //echo  $rs->Fields[1]; 
	     //echo "<br/>"; 
	     $rs->Movenext(); //灏嗚褰曢泦鎸囬拡涓嬬Щ 
	 } 
	 $rs->close(); 
	
Salin selepas log masuk

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

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

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan