当前位置:Gxlcms > PHP教程 > PHP杩炴帴MSSQL鐨勯棶棰榑PHP鏁欑▼|甯涔嬪

PHP杩炴帴MSSQL鐨勯棶棰榑PHP鏁欑▼|甯涔嬪

时间:2021-07-01 10:21:17 帮助过:2人阅读

鍦≒HP鎿嶄綔MSSQL鏃堕渶瑕佸厛纭畾绯荤粺鐨勮繍琛岀幆澧冩槸鍚︽敮鎸侊紝杩愯浠ヤ笅璇彞灏辩煡閬撲簡


[php]
if (function_exists('mssql_connect')){
echo '鏈嚱鏁板瓨鍦紝璇存槑鐜鏀寔MSSQL';
}else{
echo '浣犵殑鐜涓嶆敮鎸丮SSQL锛岃鍘籄PACHE涓厤缃?#39;;
}

if (function_exists('mssql_connect')){
echo '鏈嚱鏁板瓨鍦紝璇存槑鐜鏀寔MSSQL';
}else{
echo '浣犵殑鐜涓嶆敮鎸丮SSQL锛岃鍘籄PACHE涓厤缃?#39;;
}褰揚HP鐜涓嶆敮鎸佹椂璇峰厛瀹変互涓嬬殑鏂规硶杩涜鐜鐨勯厤缃?/p>

1銆佹墦寮€浣犵殑PHP.INI閰嶇疆鏂囦欢锛屾妸extension=php_pdo_mssql.dll鍜宔xtension=php_mssql.dll鍓嶉潰鐨?ldquo;;”鍘绘帀锛屽敖閲忔壘鍒板拰mssql鐩稿叧鐨勫瓧鐪硷紝閮芥妸浠栧惎鐢紱

2銆佷綘鐨勮繍琛岀幆澧冧腑涓嶄竴瀹氭湁杩炴帴MSSQL鐨勮繛鎺ュ簱锛屾墍浠ヤ綘蹇呴渶妫€鏌ヤ竴涓嬩綘鐨凱HP鐩綍涓嬫槸鍚﹀瓨鍦╡xt鐩綍涓嬬殑php_mssql.dll鍜宯twdblib.DLL锛岀綉涓婃湁鏂囩珷璇撮渶瑕丆OPY鍒癢INDOWS/SYSTEM32鐩綍涓嬶紝 濡傛灉杩炴帴涓嶄笂鐨勮瘽鍙互璇曚竴涓嬶紱

3銆侀噸鍚竴涓婣PACHE锛屽啀涓嶈浣犲氨鏁翠釜鏈哄瓙閲嶅惎锛堟湁鏃跺€欏氨鏄繖涔堝彉鎬侊級銆?/p>

鍋氬畬涓婇潰鐨?姝ュ悗涓嶈浠ヤ负瀹屾垚浜嗭紝鍙互鎼炲畾PHP+MSSQL浜嗭紝鍚庨潰杩樻湁瀛楃闆嗙殑闂銆?/p>


[php]
mssql_select_db($db_name,$conn);
$sql="INSERT INTO contacts (ID,MemberNo,Name,CustomerStateID,Ext,Phone,Mobile,email,QQ,Gender,Company,Province_ID,City_ID,Address,Postalcode) VALUES (4,'BX4','鍒樺姜',1,'','','13924007557','','153216429','鐢?#39;,'鍗庡悍淇濋櫓浠g悊鏈夐檺鍏徃骞夸笢鍒嗗叕鍙?#39;,0,0,'骞垮窞甯傝秺绉€鍖鸿揪閬撹矾5鍙峰箍宸炲啗鍖烘湇鍔′腑蹇冨ぇ鍘?妤?#39;,'510035')";
$sql=iconv('utf-8','gb2312',$sql);//杩欎釜杞崲蹇呴渶锛屽鏋滀綘鐨勭紪鐮佹槸涓€鑷寸殑璇濊繕濂藉姙锛屾垜灏辨槸鍦ㄨ繖涓棶棰樹笂绾犵粨浜嗗緢涔?nbsp;
$query=mssql_query($sql,$conn);

mssql_select_db($db_name,$conn);
$sql="INSERT INTO contacts (ID,MemberNo,Name,CustomerStateID,Ext,Phone,Mobile,email,QQ,Gender,Company,Province_ID,City_ID,Address,Postalcode) VALUES (4,'BX4','鍒樺姜',1,'','','13924007557','','153216429','鐢?#39;,'鍗庡悍淇濋櫓浠g悊鏈夐檺鍏徃骞夸笢鍒嗗叕鍙?#39;,0,0,'骞垮窞甯傝秺绉€鍖鸿揪閬撹矾5鍙峰箍宸炲啗鍖烘湇鍔′腑蹇冨ぇ鍘?妤?#39;,'510035')";
$sql=iconv('utf-8','gb2312',$sql);//杩欎釜杞崲蹇呴渶锛屽鏋滀綘鐨勭紪鐮佹槸涓€鑷寸殑璇濊繕濂藉姙锛屾垜灏辨槸鍦ㄨ繖涓棶棰樹笂绾犵粨浜嗗緢涔?br /> $query=mssql_query($sql,$conn);濡傛灉涓嶄笂iconv杞崲锛屼笉鍚岀殑缂栫爜浼氶€犳垚mssql_query杩斿洖false,鎴戝凡缁忎娇鐢ㄤ簡@mssql_query("SET NAMES UTF8",$conn);杩涜杞崲锛屾殏鏃朵笉鐭ラ亾涓轰粈涔堜笉琛岋紝鎵€浠ユ墍鏈夌殑SQL璇彞閮借缁忚繃杞崲銆?/p>

瀹屾垚涓婇潰鐨勫熀鏈槸鍙互瀵规暟鎹簱杩涜鎿嶄綔浜嗐€?/p>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477514.htmlTechArticle鍦≒HP鎿嶄綔MSSQL鏃堕渶瑕佸厛纭畾绯荤粺鐨勮繍琛岀幆澧冩槸鍚︽敮鎸侊紝杩愯浠ヤ笅璇彞灏辩煡閬撲簡 [php] if (function_exists(mssql_connect)){ echo 鏈嚱鏁板瓨鍦紝璇存槑鐜鏀?..

人气教程排行