php Á¬½ÓÊý¾Ý¿â £¬ ²åÈë¼Ç¼
$username = "root";
$password = "123";
// ½¨Á¢Á¬½Ó
mysql_connect('localhost', $username, $password);
// Ñ¡ÔñÁ¬½ÓÊý¾Ý¿â
mysql_select_db("test");
// ²åÈëÊý¾Ý
mysql_query("insert into tb values (12)"); // ²åÈëÊý¾Ý
Ïà¹ØÎĵµ£º
#################################
##########BY:Moskey.Tong#########
###########2009-11-15############
#########*×ªÔØÇë×¢Ã÷*############
#################################
×ܽáÒ»ÏÂÕâ¸öÐÇÆÚÌìPHPÉÏ´«Í¼Æ¬¡£
ÉÏ´«Í¼Æ¬ÔÀí£ºÊ×ÏÈÅжÏÎļþÀàÐÍÊÇ·ñΪͼƬ¸ñʽ£¬ÈôÊÇÔòÉÏ´«Îļþ£¬È»ºóÖØÃüÃûÎļþ£¨Ò»°ã¶¼ÊDZÜÃâÉ ......
Ñ»·ÒýÓÃÒ»Ö±ÊÇPHP£¨Ó¦Óã©ÖÐÒ»¸öÍ»³öµÄÎÊÌâ¡£ÎÊÌâµÄ³öÏÖÊÇÓÉÓÚÕâÑùµÄÒ»¸öÊÂʵ£ºPHPΪphpÄÚ²¿±äÁ¿Ê¹ÓÃÒ»¸ö“ÒýÓüÆÊýÆ÷”ÄÚ´æ·ÖÅä»úÖÆ¡£ÕâÒ»»úÖÆ¶ÔһЩÏà±ÈÀ´Ëµ½Ï³¤Ê±¼äÔËÐеĽű¾£¨±ÈÈ磬ӦÓ÷þÎñÆ÷»òÕßeZ²âÊÔ×é¼þ£©»áÒý·¢ÎÊÌ⣬ÒòΪÄÚ´æÔڽű¾½áÊøÇ°Ê²»»á±»ÊͷŵôµÄ¡£µ«ÊÇ£¬£¨¼¸ºõ£©Ã»ÓÐÈË ......
ÔÚʹÓÃphpÖÐʹÓÃÊý¾Ý¿âÊÂÎñ´¦Àí²¢²»¸´ÔÓ£¬Ö÷ÒªÓõ½µÄÊÇmysqliÀàµÄ3¸ö³ÉÔ±º¯Êý¡£
£¨1£©autocommit£¨bool mode£©£¬ÉèÖÃÊý¾Ý¿â×Ô¶¯Ìύ״̬¡£µ±modeΪTRUEʱ£¬´ò¿ª×Ô¶¯Ìá½»ÉèÖ㬵±modeΪFASLEʱ£¬¹Ø±Õ×Ô¶¯ÉèÖá£Ëùν×Ô¶¯Ìá½»£¬¾ÍÊÇMYSQLÿִÐÐÒ»ÌõSQLÓï¾ä£¬¸ÃSQLÓï¾äµÄÖ´Ðнá¹ûÂíÉÏÉúЧ¡£¶ø·Ç×Ô¶¯Ìύʱ£¬ÔòÖ´Ðнá¹ûÒªÒ»Ö±µ½ ......
Ê×ÏÈ£¬½¨InnoDBÀàÐÍµÄ±í£¬²ÅÄÜÖ§³ÖÊÂÎñ
$handler = mysql_connect('localhost', '', '');
mysql_select_db('test');
mysql_query('SET AUTOCOMMIT=0'); // ÉèÖÃΪ²»×Ô¶¯Ìá½»²éѯ
mysql_query('START TRANSACTION'); // ¿ªÊ¼²éѯ£¬ÕâÀïÒ²¿ÉÒÔʹÓÃBEGIN
mysql_query("INSERT INTO users VALUES ('ccc')");
mysql_query( ......
login¡£phpÌý˵ҪÓøöµÚÈý·½Ò³ÃæÀ´ÊµÏÖÌø×ª¡£ËµÊÇΪÁ˰²È«·½ÃæµÄ¿¼ÂÇ¡£ÎÒÔÙÏëÏë°É~
ÏȰѴúÂëÌù³öÀ´
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta h ......