PHPеÄÁ¬½ÓMySQL·½·¨mysqli
PHPеÄÁ¬½ÓMySQL·½·¨mysqli
1. ¿ªÆôPHPµÄAPIÖ§³Ö
£¨1£©Ê×ÏÈÐÞ¸ÄÄúµÄphp.iniµÄÅäÖÃÎļþ¡£
²éÕÒÏÂÃæµÄÓï¾ä£º
;extension=php_mysqli.dll
½«ÆäÐÞ¸ÄΪ£º
extension=php_mysqli.dll
£¨2£©ÖØÐÂÆô¶¯Apache/IIS£¬¼´¿É¡£
£¨3£©ËµÃ÷£ºPHPÐèÒªµ¥¶ÀµÄÎļþÀ´Ö§³ÖÕâ¸öÀ©Õ¹¿â£¬Ò»°ãÔÚPHPĿ¼ÏµÄextĿ¼ÀïÄÜÕÒµ½php_mysqli.dllÎļþ£¨PHP <=
5.0.2 ÖÐÊÇ
libmysqli.dll£©£¬µ±È»£¬ÔÚPHPµÄÅäÖÃÎļþµ±ÖÐÒªÓÐÕýÈ·Ö¸ÏòextµÄÐÅÏ¢£¨extension_dir£©¡£¼ÙÈôÄúµÄPHPûÓÐÕâ¸öÎļþ£¬Äú
¿ÉÒÔÈ¥ÏÂÔØPHP5µÄÔ´Âë°ü¡£ÁíÍ⣬Õâ¸öAPIÀ©Õ¹£¬Ö»ÄÜÔÚPHP5ÒÔÉϰ汾ʹÓá£ÆäËü¾ßÌåÐÅÏ¢£¬Çë¿´ÏÂÃæ¡£
2. mysqliÉí·ÝÖ¤
mysqliÊÇ“MySQL, Improved”µÄËõд£¬¸ÃÀ©Õ¹½öÊÊÓÃÓÚPHP 5¡£ËüÄÜÓÃÓÚMySQL
4.1.1ºÍ¸ü¸ß°æ±¾¡£¸ÃÀ©Õ¹ÍêÈ«Ö§³ÖMySQL
5.1ÖвÉÓõļø¶¨ÐÒ飬Ҳ֧³ÖÔ¤´¦ÀíÓï¾äºÍ¶àÓï¾äAPI¡£´ËÍ⣬¸ÃÀ©Õ¹»¹ÌṩÁËÏȽøµÄ¡¢ÃæÏò¶ÔÏóµÄ±à³Ì½Ó¿Ú¡£ÔÚhttp://php.net/mysqli
ÉÏ£¬¿ÉÕÒµ½¹ØÓÚmysqliÀ©Õ¹µÄÎĵµ¡£ÔÚhttp://www.zend.com/php5/articles/php5-mysqli.php
´¦£¬¸ø³öÁËһƪÓÐÓõÄÎÄÕ¡£
3. mysqliÔ¤¶¨ÒåÀà
mysqli
±í´ïÁË PHP ºÍ MySQL Êý¾Ý¿âÖ®¼äµÄÁ¬½Ó¡£
¹¹Ô캯Êý
mysqli - ¹¹ÔìÒ»¸öÐ嵀 mysqli ¶ÔÏó
·½·¨
autocommit - ´ò¿ª»ò¹Ø±Õ×Ô¶¯Ìá½»µÄÊý¾Ý¿âÑ¡Ïî
change_user - ¸Ä±äÖ¸¶¨µÄÊý¾Ý¿âÁ¬½ÓµÄÓû§
character_set_name - ·µ»ØÊý¾Ý¿âÁ¬½ÓµÄĬÈÏ×Ö·û¼¯
close - ¹Ø±ÕÒ»¸ö֮ǰ´ò¿ªµÄÁ¬½Ó
commit - Ìá½»µ±Ç°ÊÂÎñ
connect - ´ò¿ªÒ»¸öµ½ MySQL Êý¾Ý¿â·þÎñÆ÷µÄÐÂÁ¬½Ó
debug - Ö´ÐÐÅÅ´í²Ù×÷
dump_debug_info - È¡µÃÅÅ´íÐÅÏ¢
get_client_info - ·µ»Ø¿Í»§¶Ë°æ±¾
get_host_info - ·µ»ØÁ¬½ÓʹÓõÄÀàÐÍ
get_server_info - ·µ»Ø MySQL ·þÎñÆ÷µÄ°æ±¾
get_server_version - ·µ»Ø MySQL ·þÎñÆ÷µÄ°æ±¾
init - ³õʼ»¯ mysqli ¶ÔÏó
info - È¡µÃ×î½üÖ´ÐеIJéѯµÄÐÅÏ¢
kill - ÒªÇó·þÎñÆ÷Í£Ö¹Ò»¸ö mysql Ïß³Ì
multi_query - Ö´Ðжà¸ö²éѯ
more_results - check if more results exist from currently executed multi-query
next_result - reads next result from currently executed multi-query
options - set options
ping - pings a server connection or reconnects if there is no connection
prepare - prepares a SQL q
Ïà¹ØÎĵµ£º
1¡¢Ñ¡È¡×îÊÊÓõÄ×Ö¶ÎÊôÐÔ
MySQL
¿ÉÒԺܺõÄÖ§³Ö´óÊý¾ÝÁ¿µÄ´æÈ¡£¬µ«ÊÇÒ»°ã˵À´£¬Êý¾Ý¿âÖеıíԽС£¬ÔÚËüÉÏÃæÖ´ÐеIJéѯҲ¾Í»áÔ½¿ì¡£Òò´Ë£¬ÔÚ´´½¨±íµÄʱºò£¬ÎªÁË»ñµÃ¸üºÃµÄÐÔÄÜ£¬ÎÒÃÇ¿ÉÒÔ½«
±íÖÐ×ֶεĿí¶ÈÉèµÃ¾¡¿ÉÄÜС¡£ÀýÈ磬ÔÚ¶¨ÒåÓÊÕþ±àÂëÕâ¸ö×Ö¶Îʱ£¬Èç¹û½«ÆäÉèÖÃΪCHAR(255),ÏÔÈ»¸øÊý¾Ý¿âÔö¼ÓÁ˲»±ØÒªµÄ¿Õ¼ä£¬É ......
²éѯÓï¾ä:
SELECT ×Ö¶ÎÃû from ±íÃû.
ÅÅÐò order by ÒªÅÅÐòµÄ×Ö¶ÎÃû desc :ÒÔµ¹Ðò²éѯ.
limit ´ÓµÚ¼¸¸ö¿ªÊ¼ ²éÕÒ¶àÉÙ¸ö :²éÕÒÖ¸¶¨¸öÊý.
ͬʱ²éѯ¶à¸ö×Ö¶ÎÓÃ","¸ô¿ª.
Èç²éѯ±íÀïÃæµÄËùÓÐÊý¾ÝÔÚ×Ö¶ÎÃû´¦Ìî"*".
ÈçÖ»ÏëÏÔʾij×ֶεÄÇ°¼¸Î»×Ö·û¿ÉÒÔʹÓÃLEFTº¯Êý.
SELECT ×Ö¶ÎÃû,LEFT(×Ö¶ÎÃû,λÊý),×Ö¶ÎÃû from ±íÃû.
COU ......
MySQL Cluster
is a technology that enables
clustering of in-memory databases in a shared-nothing system. The
shared-nothing architecture allows the system to work with very
inexpensive hardware, and with a minimum of specific requirements
for hardware or software.
......
Ò». Ê×ÏÈ×öÒ»¸ö¼òµ¥µÄsoÎļþ£º
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared ......
×î½üŪphp£¬·¢ÏÖÏÂÔصÄphpEclipse²»Äܵ÷ÊÔ£¬×òÌì¾ÍÓÃÁËÒ»¸öÏÂÎçµÄʱ¼ä´î½¨ÁËphpµÄµ÷ÊÔ»·¾³¡£·¢ÏÖÍøÉϵĹØÓÚphpµ÷ÊÔµÄÎÄÕÂÈÃÈËÓеãÂÒ£¬¾ÍÕûÀíÏÂд³ÉÕâƪÎÄÕ£¬Ï£Íû¶Ô´ó¼ÒÓÐЩ°ïÖú¡£
ÔÚÍøÉϲéºÃÏñÊÇÓÐÁ½ÖÖµ÷ÊԵŤ¾ß£ºXdebugºÍZend Debugger£¬ÎÒÏÖÔÚÓõÄÊÇXdebug¡£ÎÒÖ÷Òª¾Í˵˵xampp£¬Eclipse£¬pdt£¬xdebug¹¹½¨phpµÄµ÷ÊÔ»· ......