MySQLÐÐËøÉîÈëÑо¿
À´Ô´£ºhttp://blog.csdn.net/ldb2741/archive/2010/02/25/5325161.aspx
×öÏîĿʱÓÉÓÚÒµÎñÂß¼µÄÐèÒª£¬±ØÐë¶ÔÊý¾Ý±íµÄÒ»Ðлò¶àÐмÓÈëÐÐËø£¬¾Ù¸ö×î¼òµ¥µÄÀý×Ó£¬Í¼Êé½èÔÄϵͳ¡£¼ÙÉè id=1 µÄÕâ±¾Êé¿â´æΪ 1 £¬µ«ÊÇÓÐ 2 ¸öÈËͬʱÀ´½èÕâ±¾Ê飬´Ë´¦µÄÂ߼Ϊ
view plaincopy to clipboardprint?
Select restnum from book where id =1 ;
-- Èç¹û restnum ´óÓÚ 0 £¬Ö´ÐÐ update
Update book set restnum=restnum-1 where id=1 ;
Select restnum from book where id =1 ;
-- Èç¹û restnum ´óÓÚ 0 £¬Ö´ÐÐ update
Update book set restnum=restnum-1 where id=1 ;
ÎÊÌâ¾ÍÀ´ÁË£¬µ± 2 ¸öÈËͬʱÀ´½èµÄʱºò£¬ÓпÉÄܵÚÒ»¸öÈËÖ´ÐÐ select Óï¾äµÄʱºò£¬µÚ¶þ¸öÈ˲åÁ˽øÀ´£¬ÔÚµÚÒ»¸öÈËûÀ´µÃ¼°¸üРbook ±íµÄʱºò£¬µÚ¶þ¸öÈ˲鵽Êý¾ÝÁË£¬ÆäʵÊÇÔàÊý¾Ý£¬ÒòΪµÚÒ»¸öÈË»á°Ñ restnum Öµ¼õ 1 £¬Òò´ËµÚ¶þ¸öÈ˱¾À´Ó¦¸ÃÊDz鵽 id=1 µÄÊé restnum Ϊ 0 ÁË£¬Òò´Ë²»»áÖ´ÐÐ update £¬¶ø»á¸æËßËü id=1 µÄÊéûÓпâ´æ ÁË£¬¿ÉÊÇÊý¾Ý¿âÄĶ®ÕâЩ£¬Êý¾Ý¿âÖ»¸ºÔðÖ´ÐÐÒ»ÌõÌõ SQL Óï¾ä£¬Ëü²Å²»¹ÜÖмäÓÐûÓÐÆäËû sql Óï¾ä²å½øÀ´£¬ËüÒ²²»ÖªµÀÒª°ÑÒ»¸ö session µÄ sql Óï¾äÖ´ÐÐÍêÔÙÖ´ÐÐÁíÒ»¸ö session µÄ¡£Òò´Ë»áµ¼Ö²¢·¢µÄʱºò restnum ×îºóµÄ½á¹ûΪ -1 £¬ÏÔÈ»ÕâÊDz»ºÏÀíµÄ£¬ËùÒÔ£¬²Å³öÏÖËøµÄ¸ÅÄ Mysql ʹÓà innodb ÒýÇæ¿ÉÒÔͨ¹ýË÷Òý ¶ÔÊý¾ÝÐмÓËø¡£ÒÔÉϽèÊéµÄÓï¾ä±äΪ£º
view plaincopy to clipboardprint?
Begin;
Select restnum from book where id =1 for update ;
-- ¸ø id=1 µÄÐмÓÉÏÅÅËüËøÇÒ id ÓÐË÷Òý
Update book set restnum=restnum-1 where id=1 ;
Commit;
Begin;
Select restnum from book where id =1 for update ;
-- ¸ø id=1 µÄÐмÓÉÏÅÅËüËøÇÒ id ÓÐË÷Òý
Update book set restnum=restnum-1 where id=1 ;
Commit;
ÕâÑù£¬µÚ¶þ¸öÈËÖ´Ðе½ select Óï¾äµÄʱºò¾Í»á´¦Óڵȴý״ֱ̬µ½µÚÒ»¸öÈËÖ´ÐÐ commit
Ïà¹ØÎĵµ£º
Tomcat ÏÂ×îÈÝÒ×µ½µÄÎÊÌâ¾ÍÊÇÖÐÎÄÂÒÂëÎÊÌâÁË , ÏÂÃæ¾ÍÀ´Ì¸Ì¸ÎÒÔÚ Windows +Tomcat5 ϵ÷ÊÔ JSP ³ÌÐòʱ , ËùÅöµ½µÄÎÊÌâÒÔ¼°½â¾ö°ì·¨¡£
Õâ´Îµ÷ÊÔËùÓöµ½µÄÂÒÂëÎÊÌâÖ÷ÒªÓÐÈýÀࣺ
Ò»¡¢ Ò³Ãæ×Ö·ûÂÒÂë¡£
¼´Õû¸öÒ³Ãæ³öÏÖºº×ÖÂÒ ......
[part1] http://download.csdn.net/source/2076258
[part2] http://download.csdn.net/source/2076272
[part3] http://download.csdn.net/source/2076276
[part4] http://download.csdn.net/source/2076283
[part02-04] http://www.ytgps.com/Images/nginx.rar
±¾ÎļþÌå»ý¹ý´ó·Ö4¸ö°ü£¬php-cgi+mysql+nginx.7z ......
³õѧmysqlÎÒÒ²Åöµ½ÖÐÎÄ´æ´¢µÄÎÊÌ⣬ÒÔÏÂÊÇÎҵĽâ¾ö·½°¸£º
1.Ê×ÏÈÔÚ×Ö¶ÎÑ¡Ïîcolumn option Öн«×Ö¶Î×Ö·û¼¯column charsetÉèΪgb2312¡£
2.»¹ÐèÒªÔÚ±íÑ¡Ïîtable option ÖÐͬÑù½«charsetÉèÖÃΪgb2312.
3.×îºóÈç¹û»¹²»ÐУ¬¾ÍÔÚmysql°²×°Ä¿Â¼ÏÂÕÒµ½my.ini,ÕÒµ½ÒÔÏÂλÖãº
[mysql]
default-cha ......
MysqlµÄ°²×°Îļþ¿ÉÒÔÖ±½Óµ½ http://www.mysql.com ÏÂÔØ£¬»ñµÃfor win32µÄ.zip°ü£¬½¨ÒéÑ¡Ôñ4.0.20d°æ±¾¡£ÕâÀï²»Ïêϸ˵Ã÷¡£
¡¡¡¡ÏÂÔØ»ñµÃMysqlµÄfor win32°²×°°üºó£¬ÓÃwinzip½âѹËõ£¬Ö±½ÓÔËÐÐsetup.exe£¬ÐèҪעÒâµÄÊÇÑ¡ÔñÒ»¸ö°²×°Â·¾¶£¬µ±È»£¬°²×°Â·¾¶¿ÉÒÔÈÎÒ⣬½¨ÒéÑ¡ÔñC:\MySQLĿ¼¡£°²×°Íê³ÉºóMySQLÒ²¾ÍÍê³ÉÁË¡£Ä¬ÈϵÄÓû ......
Real example:
/*************************by garcon1986*********************************************************/
<?php
// get the values from entreprise creation form
$secteur = $_POST['secteur'];
$nom = $_POST['nom_entreprise'];
$taille = $_POST['taille_entreprise'];
$concurrent = $_POST[' ......