Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ò»ÖÖ²»´íµÄ´ÓSQLתMysqlÊý¾Ý¿âµÄ·½·¨

Äê³õµÄʱºòÒ»Ö±ÔÚ×öÒ»¸öÍøÕ¾MSSQL2000->MySQL5µÄǨÒƹ¤×÷£¬ÒòΪ²ÉÓÃÁ˲»Í¬µÄ³ÌÐòϵͳ£¬ËùÒÔÖ÷ÒªÎÊÌâÔÚÊý¾ÝµÄǨÒÆ¡£ÓÉÓÚ2¸öϵͳÊý¾Ý¿â½á¹¹²îÒì·Ç³£´ó£¬²»·½±ã²ÉÈ¡SQLSERVERÀïµ¼ÈëMYSQLµÄODBCÊý¾ÝÔ´µÄ¹¦ÄÜ£¨Ò²²»ÍƼöÕâô×ö£¬×Ö¶ÎÀàÐ͵Ȳ»Í¬µã»á¸ãËÀÈ˵ġ«£©£¬Òò´Ë¾ÍÔÚWINDOWSÏÂ×Ô¼ºÐ´PHP½Å±¾´ÓSQLSERVERÀï¶ÁÊý¾Ý£¬È»ºó°´ÕÕÐÂϵͳµÄÐèÒª´¦ÀíÖ®ºó²åÈëMYSQLÀïÃ棬Áé»îÒ²±È½Ï·½±ã¡£Êµ¼Ê¹ý³ÌÖ÷ÒªÓÐÏÂÃ漸¸öÎÊÌ⣺
1¡¢Êý¾Ý¿âµÄÁ¬½Ó£¬Ö÷ÒªÊÇÁ¬½ÓSQLSERVER¡£Ö÷ÒªÓÐ3ÖÖ·½·¨£º
1.1ÀûÓÃPHPÖеÄmssql_ϵÁк¯Êý£¬Õâ¸öÓëʹÓÃmysql_ϵÁк¯ÊýÀàËÆ£¬²»¹ýÒª´ò¿ªphp.iniÖÐÏà¹ØÀ©Õ¹£¨extension=php_mssql.dll£©¡£
1.2ÀûÓÃODBCÁ¬½Ó£¬ÓÉÓÚ³éÏóÁ˾ßÌåÊý¾Ý¿â£¬ËùÒÔûÓа취ÀûÓÃÊý¾Ý±í×Ö¶ÎÃû=>Êý×é¼üÃûµÄÌØÐÔ£¬ÔÚÕë¶Ô¾ßÌåÓ¦ÓÃʱ²»ÊǺܷ½±ã£¬´úÂëÐÎʽ£º
 
$conn=odbc_connect("datasource","username","password");
$sql="select*fromnews";
$cur=odbc_exec($conn,$sql);
while(odbc_fetch_row($cur)){
$field1=odbc_result($cur,1);
$field2=odbc_result($cur,2);
//dosomething
}
1.3ʹÓÃPDO-PHP5ÖмÓÈëÊý¾Ý¶ÔÏó³éÏó²ã£¬×÷Ϊ¹Ù·½ÍƳöµÄÊý¾Ý·ÃÎʽӿڣ¬ÓŵãÓкܶ࣬±ÈÈçÖ§³Ö²ÎÊý°ó¶¨ÒÔ·ÀÖ¹SQL×¢È룻¶ÔÓÚ²»Í¬Êý¾Ý¿â¼ÓÔز»Í¬Çý¶¯¼´¿É£¬³ÌÐò´úÂëÊÇÒ»Öµģ¬±ãÓÚÒÆÖ²µÈµÈ£¬ÏàÐÅÓ¦¸ÃÊÇ´óÊÆËùÇ÷¡£²»¹ýÓÉÓÚÓÃÁËPHP5ȫеÄÃæÏò¶ÔÏóÌØÐÔ£¬ÐèÒªPHP5µÄÖ§³Ö£¬5.1¿ÉÒÔÖ±½ÓʹÓã¬5ÐèҪװPECL£¬ÁíÍ⻹ҪÐÞ¸ÄPHP.ini£¬Ôö¼Ó£ºextension=php_pdo_mysql.dllºÍextension=php_pdo_mssql.dll£¬Êµ¼Ê´úÂëÈçÏÂ:
 
try{
$DBH=newPDO("mssql:dbname=XXX;host=localhost",¡¡
"root","password");//ConnecttoDB
}catch(PDOException$e){
print"Error!:".$e->getMessage();//ErrorMessage
die();
}
$stmt=$DBH->prepare("SELECT*fromnews");//StmtHandle$stmt
if($stmt->execute()){
while($row=$stmt->fetch()){
//dosomething
}
}
$stmt2=$mssql->prepare("INSERTINTOnews¡¡
(title,author)VALUES(:title,:author)");
$stmt2->bindParam(':title',$title);
$stmt2->bindParam(':author',$author);
$stmt2->execute();
$DBH=null;//CloseConnectionÕâÀïÒªÌáÐÑϵÄÊÇMSSQLÀïÃæÊÇûÓÐMYSQLÖÐLIMITÕâ¸öÓï·¨µÄ¡£
 
2¡¢TEXT×ֶα»½Ø¶ÏµÄÎÊÌâ¡£
ÉÏÃæ³¢ÊÔÁË3ÖÖÁ¬½ÓÊý¾Ý¿â·½·¨£¬ÊÇÒòΪµ±³õÁ¬ÉÏMSSQLºóSELECT³öÀ´µÄÊý¾Ý×ÜÊÇÖ»ÓÐ4K³¤¶È


Ïà¹ØÎĵµ£º

windowsÏÂPHP5+APACHE+MYSQLÍêÕûÅäÖÃ

Èí¼þ°æ±¾:
php-5.2.13-Win32
apache_2.2.9-win32-x86-no_ssl-r2.msi(×¢Ò⣺APACHE 2.2.X°æ±¾ÒÔÉÏÒªÔö¼Ó²å¼þ²ÅÖ§³ÖPHP 5µÄ)
mysql-5.1.44-win32.msi
ÏÈ×°µÄphp5,Ö±½Ó½âѹÎļþµ½C:\php(°²×°µ½ÄÄÀï²¢²»»áÓÐÓ°Ï죬ƾ¸öÈËϲºÅ£¬±¾ÎÄÖеÄËùÓз¾¶¶¼ÒÔÎҵݲװ·¾¶£¬Çë´ó¼ÒÔÚ×Ô¼ºµÄ»úÆ÷ÉÏ°²×°µÄʱºò×¢ÒâÐÞ¸ÄΪ×Ô¼ºµÄ·¾¶)
½Ó× ......

MYSQL ´¥·¢Æ÷


´¥·¢Æ÷ÔÚmysqlÖÐÓ¦ÓõIJ»¶à,ËüÊÇÔÚmysql5ÒÔÉϲſªÊ¼Ö§³ÖµÄ,²»Ö§³Ö²»´ú±íËü²»ÖØÒª,Ê×ÏÈÁ˽âÒ»ÏÂʲôÊÇ´¥·¢Æ÷.´¥·¢Æ÷ÊÇÔÚÊý¾Ý¿âÖÐΪÏìÓ¦Ò»¸öÌØÊâ±í¸ñÖеÄijЩʼþ¶ø×Ô¶¯Ö´ÐеijÌÐò´úÂë¡£(Wikipedia)˵µÃ¼òµ¥Ò»Ð©£¬ËüÊÇÔÚÒ»¸öÌØÊâµÄÊý¾Ý¿âʼþ£¬ÈçINSERT»òDELETE·¢Éúʱ£¬×Ô¶¯¼¤»îµÄÒ»¶Î´úÂë¡£´¥·¢Æ÷¿É·½±ãµØÓÃÓÚÈÕÖ¾¼Ç¼¡¢¶Ô ......

Fedora 8ÏÂÓÃYum°²×°Apache+PHP+MySQL»·¾³


fedora8 ÓÃyumÀ´¹ÜÀí°²×°Apache+PHP+MysqlµÄ»ù±¾°²×°¡£
1. °²×°Apahce, PHP, Mysql, ÒÔ¼°phpÁ¬½Ómysql¿â×é¼þ¡£
yum -y install httpd php mysql mysql-server php-mysql
2. ÅäÖÿª»úÆô¶¯·þÎñ
/sbin/chkconfig httpd on             [ÉèÖÃapache·þÎñÆ÷httpd·þÎñ¿ª»úÆô¶¯]
......

MySQLµ¼Èë/µ¼³ö.sqlÎļþ


µ¼³ö.sqlÎļþ
1.½«Êý¾Ý¿âtransfer_server_dbµ¼³öµ½transfSRV.sqlÎļþÖУº
    mysqldump -u root -p transfer_server_db > /home/eric/transfSRV.sql
2.½«Êý¾Ý¿âtransfer_server_dbÖеÄdevice_info_tableµ¼³öµ½table.sqlÎļþÖУº
    mysqldump -u root -p transfer_server_db devi ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ