PHP´æÈ¡SQL ServerÊý¾Ý¿â
1.Ñ¡Ôñ²Ù×÷µÄÊý¾Ý¿â
Á¬½Óµ½·þÎñÆ÷Ö®ºó£¬Ê×ÏÈÐèҪѡÔñÒª½øÐвÙ×÷µÄÊý¾Ý¿â¡£Ê¹ÓÃPHPµÄMSSQLÀ©Õ¹¿âÖеÄmssql_select_db()º¯Êý¼´¿ÉʵÏÖÁ¬½Ó·þÎñÆ÷ÉϵÄÊý¾Ý¿â¡£¸Ãº¯Êý¸ñʽÈçÏ£º
bool mssql_select_db(string database_name[,resource link_identifier)
¸Ãº¯Êý¸÷²ÎÊýÒâÒ壺
a. ²ÎÊý database_nameΪָ¶¨µÄ·þÎñÆ÷ÉÏ¿ÉÓõÄÊý¾Ý¿âÃû³Æ£¬ÒÔ×Ö·û´®±íʾ¡£
b.²ÎÊýlink_identifierΪָ¶¨º¯Êýmssql_connect()´ò¿ªSQL Server µÄÁ¬½Ó±êʶ¡£Èç¹ûÊ¡ÂԸòÎÊý£¬ÏµÍ³½«»á×Ô¶¯µ÷ÓÃ×îºóÒ»´Î´ò¿ªSQL Server·þÎñÆ÷µÄÁ¬½Ó¡£
ÔËÐиú¯Êý½«»áÑ¡ÔñÖ¸¶¨µÄÊý¾Ý¿â£¬²¢¸ù¾ÝÊÇ·ñÓÐÎó·µ»ØÏàÓ¦µÄ²¼¶ûÖµ¡£Èç¹û³É¹¦Ñ¡ÔñÖ¸¶¨µÄÊý¾Ý¿âÔò·µ»Øtrue£¬·´Ö®Ôò·µ»Øfalse¡£
¶ÔSQL Server·þÎñÆ÷ÉÏÖ¸¶¨Êý¾Ý¿âµÄÁ¬½Ó´úÂ룺
<?php
$hostname="datahost";
$dbuser="sa";
$dbpasswd="123";
$conn=mssql_connect($hostname,$dbuser,$dbpasswd);
if ($conn)
{
$db_name="ming";
$myselect_db=mssql_select_db($db_name);
if($myselect_db)
{
echo "<font color=#666666>ÄúÑ¡ÔñµÄÊý¾Ý¿â: </font><strong><font color=green>".$db_name."</font></strong>";
}
else
{
echo "ûÓÐÑ¡¶¨Êý¾Ý¿â: <strong><font color=red>".$db_name."</font></strong>";
}
}
else
{
echo "Á¬½Óʧ°Ü£¡";
}
mssql_close($conn);
?>
½á¹ûÑÝʾ£ºhttp://mingking.limewebs.com/db/myselect_db.php
Ïà¹ØÎĵµ£º
ΪʲôҪͬ²½SQL Server 2000 Êý¾Ý¿â£¬Ëü¶¼ÓÃÔÚʲô³¡ºÏ
Êý¾Ýʵʱ±¸·Ýͬ²½£¬Êý¾Ý¿â·þÎñÆ÷³öÎÊÌâʱÎÒÃÇÒ²ÓÐÆäÕý³£¹¤×÷ʱµÄ±¸·Ý
Êý¾Ýʵʱ±¸·Ýͬ²½£¬Ò»Ì¨·þÎñÆ÷¸ºÔز»Æðʱ£¬¿ÉÒÔÓÃÀ´×ö¸ºÔؾùºâ
Êý¾Ýʵʱ±¸·Ýͬ²½£¬Êý¾Ý¿â·þÎñÆ÷¿ÉÒÔÎÞ¼ä¶Ï£¬ÎÞËðʧǨÒÆ
Ö÷·þÎñÆ÷±»¹¥»÷»òµ±»úʱÁíһ̨·þÎñͬ²½»ú¿ÉÒÔÓ¦¼±
¡£¡£¡£¡£¡£¿ÉÒÔ˵ ......
MySQL 5.0 ÒÔÉÏÖ§³Ö´æ´¢¹ý³Ì¡£
PHP 5.0 ÒÔÉ쵀 mysqli ϵÁк¯Êý¿ÉÒÔÖ§³Ö²Ù×÷ MySQL µÄ´æ´¢¹ý³Ì¡£
ÒÔÏÂÊÇһЩ¼òµ¥µÄ´æ´¢¹ý³ÌºÍÓà PHP µ÷ÓõÄʾÀý¡£ Ò»¡¢·µ»Øµ¥¸öÊý¾Ý: 1: <?php
2: header("Content-Type:t ......
function getsock($strUrl,$arrParameter=array(),$strMethod="POST"){
if(!$strUrl||!$strMethod){ return "";}
$strMethod = strtoupper($strMethod);
$arrUrl = parse_url($strUrl);
if($arrUrl["port"]==0){$arrUrl["port"]=80;}
$fso = fsockopen($arrUrl["host"],$arrUrl["port"] ......
±¾ÎÄÈí¼þµÄÏÂÔصØÖ·¾Í²»Áгö£¬Ö÷ÒªÊǼǼ°²×°Ê±µÄ²½Öè¼°Ïà¹ØÎÊÌâµÄ´¦Àí·½·¨£»»ùÓÚ°²×°·½·¨Ä¿Ç°ÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÀûÓÃRPM°ü°²×°£¬Ò»ÖÖÔ´Âë±àÒë°²×°£»ÒÔÏÂÖ÷
ÒªÊÇÒÔÔ´Âë±àÒë°²×°£»ÒòΪԴÂë°²×°Èí¼þµÄÏ໥ÒÀÀµÐÔС£¬°²×°·½Ê½Óø÷ÖÖunix/linuxϵͳ£¬Î¬»¤·½±ã¡£Èç¹ûÏëÈ¥³ýÏà¹Ø·þÎñʱ£¬Ö±½Órm
–rfĿ¼ ¼´¿É£»½¨Òé²ÉÓÃÔ´Âë· ......
PHPÖÐÒýÓÃÖ¸µÄÊDz»Í¬µÄÃû×Ö·ÃÎÊͬһ¸ö±äÁ¿ÄÚÈÝ. µ«ÕâÓë£ÃÓïÑÔÖеÄÖ¸ÕëÊÇÓвî±ðµÄ£®£ÃÓïÑÔÖеÄÖ¸ÕëÀïÃæ´æ´¢µÄÊDZäÁ¿µÄÄÚÈÝÔÚÄÚ´æÖдæ·ÅµÄµØÖ·¡£
¹ØÓÚ¶Ô±äÁ¿£¬º¯Êý»òÕßÀàµÄÒýÓò»¶à˵£¬µ«ÒªËµÒ»ÏÂunsetÒ»¸öÒýÓã¬Ê¾Àý£º
<?php
$a = "hello";
$b =&$a;
unset($b);
echo '$a:'.$a;
//output:$a:hello
?> ......