PHPÊý¾Ý¿âÊÂÎñ´¦Àí
ÔÚʹÓÃphpÖÐʹÓÃÊý¾Ý¿âÊÂÎñ´¦Àí²¢²»¸´ÔÓ£¬Ö÷ÒªÓõ½µÄÊÇmysqliÀàµÄ3¸ö³ÉÔ±º¯Êý¡£
£¨1£©autocommit£¨bool mode£©£¬ÉèÖÃÊý¾Ý¿â×Ô¶¯Ìύ״̬¡£µ±modeΪTRUEʱ£¬´ò¿ª×Ô¶¯Ìá½»ÉèÖ㬵±modeΪFASLEʱ£¬¹Ø±Õ×Ô¶¯ÉèÖá£Ëùν×Ô¶¯Ìá½»£¬¾ÍÊÇMYSQLÿִÐÐÒ»ÌõSQLÓï¾ä£¬¸ÃSQLÓï¾äµÄÖ´Ðнá¹ûÂíÉÏÉúЧ¡£¶ø·Ç×Ô¶¯Ìύʱ£¬ÔòÖ´Ðнá¹ûÒªÒ»Ö±µ½commit£¨£©Óï¾ä±»Ö´ÐÐʱÉúЧ£¬»òÕßµ½rollback£¨£©Óï¾ä±»Ö´ÐÐʱִÐнá¹û±»È¡Ïû£¬Êý¾Ý¿â»Ø¸´µ½µ±Ç°ÊÂÎñ֮ǰµÄ״̬¡£ÁíÍ⣬±¾º¯ÊýÖ»Ó°Ï쵱ǰÊý¾Ý¿âÁ¬½Ó¼ä·¢ÉúµÄÊý¾Ý¿â²Ù×÷£¬¼´ÔÚÒ»ÏÂÒ»Êý¾Ý¿âÁ¬½Ó½¨Á¢Ö®ºó£¬×Ô¶¯Ìύ״̬½«¸´³ÉMysqlÊý¾Ý¿âÄÚ²¿µÄÉèÖá£
£¨2£©commit(),Ìá½»µ±Ç°ÊÂÎñµÄÖ´Ðнá¹û¡£
£¨3£©rollback£¨£©£¬È¡Ïûµ±Ç°ÊÂÎñµÄÖ´Ðнá¹û¡£
PHPÖÐʹÓÃÊÂÎñ´¦ÀíµÄ´úÂë¿ò¼ÜÈçÏÂËùʾ£º
<?php
$conn=db_connect();//Á¬½ÓÊý¾Ý¿â¸Ãº¯ÊýΪÁíÍⶨÒåµÄ¡£
$conn->autocommit(FALSE);
$rsl = $conn->query($sql1);
$rs2 = $conn->query($sql2);
...
$rsn= $conn->query($sqln);
if($rs1&&$rs2&&...&$sqln)
$conn->commit();
else
$conn->rollback();
$conn->close();
?>
Ïà¹ØÎĵµ£º
ÔÚʵ¼Ê¿ª·¢¹ý³Ì»á¾³£»áÓöµ½Ò»Ð©Öظ´µÄ²Ù×÷£¬Èç¹ûÿ´Î¶¼Òª×Ô¼ºÈ¥ÊµÏÖÕâÎÞÒɼÓÖØÁË×Ô¼ºµÄ¹¤×÷Á¿£¬ÏÂÃæ¶ÔһЩ¿ÉÄܾ³£Óõ½µÄÀà×ö¸öÕûÀí£º
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµ¥¾ÍÄÜ´´½¨¸´ÔÓµÄͼ±íºÍͼƬ¡£µ±È»£¬ËüÃÇÐèÒªGD¿âµÄÖ§³Ö¡£
pChart - Ò»¸ö¿ÉÒÔ´´½¨Í³¼ÆͼµÄ¿â¡£
Libchart - ÕâÒ²ÊÇÒ»¸ö¼òµ¥µÄͳ¼Æͼ¿â¡£
JpGraph - Ò» ......
¡¡¡¡»¥ÁªÍøµÄ½ñÌ죬AJAXÒѾ²»ÊÇʲôİÉúµÄ´Ê»ãÁË¡£ËµÆðAJAX£¬¿ÉÄÜ»áÁ¢¼´ÏëÆðÒòRSS¶øÐËÆðµÄXML¡£XMLµÄ½âÎö£¬¿ÖÅÂÒѾ²»ÊÇʲôÄÑÌâÁË£¬ÌرðÊÇPHP5£¬´óÁ¿µÄXML½âÎöÆ÷µÄÓ¿ÏÖ£¬Èç×îÇáÁ¿¼¶µÄSimpleXML¡£²»¹ý¶ÔÓÚAJAXÀ´Ëµ£¬XMLµÄ½âÎö¸üÇãÏòÓÚǰ̨JavascriptµÄÖ§³Ö¶È¡£ÎÒÏëËùÓнâÎö¹ýXMLµÄÈË£¬¶¼»áÒòÊ÷ºÍ½Úµã¶øÍ·´ó¡£²»¿É·ñÈÏ£¬X ......
ÒÔÇ°Ò»Ö±¸ãC++½øÐÐC/S¿ª·¢£¬Ôø¾µÄÏë·¨ÊÇÈç¹ûÓлú»á£¬Ñ§Ñ§¸ãÍøÕ¾ºÍǶÈëʽ¿ª·¢
ûÏëµ½ÕÒµ½¹¤×÷µÄµÚ2Ìì¾ÍÓÐÁË×öÍøÕ¾µÄ»ú»á£¬Ò²×¬µ½ÁË×Ô¼º´óѧÆÚ¼ä×î¸ßµÄÒ»·Ý¹¤×Ê£¬10Ìì1000¿é
ÔÚʲôµÄ¶¼²»»áµÄÇé¿öÏ£¬¾¡È»´ðÓ¦ÈËÊ´¦µÄÀÏʦһ¸öÐÇÆÚдºÃÍøÕ¾µÄºǫ́
ÎÒ³ÐÈÏÕÒµ½¹¤×÷ºó×Ô¼ºÊÇÓеã¿ñÁË£¬ºÜ¶àÊÂûעÒâµ½£¬ºÜ¶àʺó»Ú²»ÁË¡£¡£¡£
......
#################################
##########BY:Moskey.Tong#########
###########2009-11-15############
#########*תÔØÇë×¢Ã÷*############
#################################
×ܽáÒ»ÏÂÕâ¸öÐÇÆÚÌìPHPÉÏ´«Í¼Æ¬¡£
ÉÏ´«Í¼Æ¬ÔÀí£ºÊ×ÏÈÅжÏÎļþÀàÐÍÊÇ·ñΪͼƬ¸ñʽ£¬ÈôÊÇÔòÉÏ´«Îļþ£¬È»ºóÖØÃüÃûÎļþ£¨Ò»°ã¶¼ÊDZÜÃâÉ ......