phpÓëmysqlÔ×Ó²Ù×÷
ºÜ¾Ã¶¼Ã»ÓÐдһÏÂѧϰÈÕÖ¾ÁË,¶¼²»ÖªµÀ×î½üÔÚæʲô,ͻȻ¾õµÃ×Ô¼ºÓ¦¸ÃдµãʲôÉÏÈ¥.
Êý¾Ý¿âµÄÔ×Ó²Ù×÷ÊÇÁ½Èý¸öÔÂǰѧµÄ¶«Î÷ÁË,½ñÌìͻȻÓÖÓõ½ÁË,Òò´Ë½ñÌì±ØÐëµÃ½«Æä¼Ç¼ÏÂÀ´,·ñÔòÏ´ÎÓÖÒªÖØÐÂËÑË÷ÁË.
Ô×Ó²Ù×÷³£Óõķ½·¨¾ÍÊÇͨ¹ýÊý¾Ý»Ø¹öÀ´ÊµÏÖ,Óà PHP À´ÊµÏÖÊý¾Ý¿â»Ø¹ö²Ù×÷Ï൱¼òµ¥:
1, ½¨Á¢Êý¾Ý¿âÁ¬½Ó
2, mysql_query('BEGIN'); ¿ªÆôÊÂÎñ
3, $SQL = "...";
mysql_query($SQL); ×öÏàÓ¦µÄÊý¾Ý¿â²Ù×÷
4, ÅжϻعöÌõ¼þ:
if(mysql_errno)
{
print mysql_error();
mysql_query('ROLLBACK'); ³ö´í¾Í»Ø¹ö
exit();
}
5, ... ¿ÉÒÔÖظ´ÉÏÊö²½Öè 3 ¼°²½Öè 4 µÄ²Ù×÷, ¿ªÊ¼µÄ¹ý³Ì(Öмä¿ÉÒÔ¼ÓÈëÆäËû²Ù×÷£¬²»¾ÖÏÞÓÚÊý¾Ý¿â¸üУ¬µ«ÊÇ×¢Ò⣬×îºÃ²»ÒªÈÃÒ»¸öÊÂÎñʱ¼ä¹ý³¤£¬ÒòΪËüËø¶¨ËùÓÐÄãÓõ½µÄ±í£¬»áÓ°ÏìÆäËû³ÌÐòʹÓÃ)
ÄãÒ²¿ÉÒÔÔÚ¼¸ÌõÕýÈ·µÄsql¸üÐÂÓï¾äºó¹ÊÒâдһ¾ä´íÎóµÄ£¬¿´¿´ÊÇ·ñ»Ø¹öÁË¡£
6, ½áÊø»Ø¹ö²Ù×÷
mysql_query('COMMIT'); Äܹ»µ½ÕâÀ´ú±íÉÏÊöÊý¾Ý¿â²Ù×÷¶¼Ã»ÓÐ´í£¬ÕýʽÌá½»Ö´ÐÐ
Õâ¾ÍÊÇÓà PHP ʵÏÖÔ×Ó²Ù×÷µÄÕû¸ö¹ý³Ì,ÐèÒªÌرð×¢ÒâµÄÊǽ¨Á¢Ö§³ÖÊý¾Ý»Ø¹ö²Ù×÷µÄ±í½á¹¹,ÁíÍâ,³ý commit ÍâÒ²ÓÐÆäËü°ì·¨¿ÉÒÔ½áÊø»Ø¹ö²Ù×÷,µ«ÎҾͲ»µÃ¶øÖªÁË.
Ïà¹ØÎĵµ£º
½øÐÐÎļþµÄ¶ÁºÍд£¬ÏÈ´ò¿ªÒ»¸öÎļþ£¬È»ºó¿ªÊ¼¶Á»òÕßдÎļþ£¬×îºóÔÙ¹ØϵÕâ¸öÎļþ×ÊÔ´¡£
È磬ÎļþµÄ¶Á²Ù×÷£º
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //µ±Ã»ÓжÁÈ¡µ½Îļþ½á⣬¼ÌÐøÑ»·¶ÁÈ¡²Ù×÷
$line = fgets($file); //¶ÁÈ¡µ½Ò»ÐеÄÄÚÈÝ
echo $line.'<br/>';
}
fclose($file) ......
http://www.javaeye.com/topic/211951
Õâ¶Îʱ¼äÔÚ¿´¡¶High Performance MySQL¡·£¬¿´µ½´æ´¢ÒýÇæÕâ¸öµØ·½¸Ðµ½ºÜ¶àϸ½Ú±È½ÏÄ°Éú£¬ËùÒÔ×ܽáС¼ÇһЩ
ΪÁËÊÊÓ¦¸÷ÖÖ²»Í¬µÄÔËÐл·¾³£¬MYSQLÌṩÁ˶àÖÖ²»Í¬µÄ´æ´¢ÒýÇ棨Storage Engine £©,ÔÚÓ¦ÓóÌÐò¿ª·¢Õâ¸ö²ãÃæÉÏ£¬¿ª·¢Õß¿ÉÒÔ¸ù¾Ý²»Í¬µÄÐèÇóÑ¡ÔñÊʺϵÄStorage Engine ·½°¸£¬¸üΪÁ ......
ÎÒÔÚ°²×°XAMPP 1.7.0ʱ£¬°²×°³É¹¦ºó£¬´òËãÆô¶¯XAMPP¡£Apache˳ÀûÆô¶¯£¬µ«ÊÇMySqlÔõô¶¼Æô¶¯²»ÁË£¬ÌáʾµÄ´íÎóÊÇ£º
error:mysql service not started [-1]
ÎÒÖØÐÂ×°Á˼¸´Î¶¼²»ÐУ¬ÏÂÔØÁËÆäËûµÄ°æ±¾Ò²²»ÐУ¬ÎÒÕæ¸ã²»Çå³þΪʲô¡£ÎÒGoogleÁË°ëÌ죬ÆðÏÈʱÖÐÎÄÍøÒ³£¬°´ÕÕ¼¸¸ö½â¾ö·½·¨×öÁ˶¼²»ÐУ¬¿Ï¶¨ÊÇûÓжÔÖ¢ÏÂÒ©°Ñ£¬È»ºóÎÒµ ......
my.iniÎļþÅäÖ㺠[mysql] default-character-set=GBK #´Ë´¦µÄ±àÂëÊÇMySQL¿ØÖÆ̨ÏÔʾµÄ±àÂ뷽ʽ£¬Ó¦¸ÃÉèÖÃΪGBK [mysqld] default-character-set=utf8 #´Ë´¦µÄ±àÂëÊÇMySQLÊý¾Ý´æ´¢µÄ¸ñʽ£¬Ó¦¸ÃÉèÖÃΪutf8£¬¿ÉÒÔ´æ´¢ÊÀ½çÉϾø´ó¶àÊý×Ö·û ......
½¨Á¢Íâ¼üµÄÇ°Ì᣺ ±¾±íµÄÁбØÐëÓëÍâ¼üÀàÐÍÏàͬ(Íâ¼ü±ØÐëÊÇÍâ±íÖ÷¼ü)¡£
Íâ¼ü×÷Ó㺠ʹÁ½ÕűíÐγɹØÁª£¬Íâ¼üÖ»ÄÜÒýÓÃÍâ±íÖеÄÁеÄÖµ£¡
Ö¸¶¨Ö÷¼ü¹Ø¼ü×Ö£º foreign key(ÁÐÃû)
ÒýÓÃÍâ¼ü¹Ø¼ü×Ö£º references <Íâ¼ü±íÃû>(Íâ¼üÁÐÃû)
ʼþ´¥·¢ÏÞÖÆ: on deleteºÍon update , ¿ÉÉè²ÎÊýcascade(¸úËæÍâ¼ü¸Ä¶¯ ......