MySQLÊý¾Ý¿â¹ØÁªµÄÎÊÌâ
ÎÒ½¨ÁËÁ½¸ö±í£¬Ò»¸ö±íÃ÷user£¬Ò»¸ö±íanswer
±íuserµÄ½á¹¹{id,username,password}
±íanswerµÄ½á¹¹{A_id,question,answer,U_id}
Çë½Ì´ó¼ÒÎÒÔõôÉèÖòÅÄÜÔÚ±íuser²åÈëÊý¾Ýʱ£¬±íanswer¶ÔÓ¦µÄU_id×Ô¶¯¸üжÔÓ¦±íuserµÄid ¡£
ÄÇλ´óÏÀ£¬¸øдÏ´úÂë¿ÉÒÔÂ𣿣¿£¿
Èç¹ûÓÃPHPºÜÈÝÒ×½â¾ö£¬
Èç¹ûÓÃMYSQL¿ÉÒÔÓô¥·¢Æ÷½â¾ö£¡
1Â¥µÄ£¬Äã¿ÉÒÔ°ÑÁ½ÖÖ·½·¨¸ø˵Ã÷ÏÂÂ𣿣¿£¿
²»Ì«Ã÷°×ÄãµÄÒâ˼?Ϊʲôuser±íÌí¼ÓÊý¾Ýanswer±í¾ÍÒª¸üУ¿ÄãÏ£ÍûÔõÑù¸üУ¿¸üеÄÌõ¼þÊÇʲô£¿
ÎÒµÄÊý¾Ý±íanswerµÄU_id¶ÔÓ¦µÄÊDZíuserµÄid£¬ÎÒÔÚ²åÈëÊý¾Ýʱ£¬±íuserµÄid×Ô¶¯²åÈëÊý×Ö£¬ÎÒÏëÈñíanswerµÄU_id£¬Ò²×Ô¶¯²åÈëÊý×Ö£¬µ«²åÈëµÄÊý×Ö£¬ÒªºÍ±íuserµÄidµÄÊý×Ö±£³ÖÒ»ÖÂÐÔ£¬Á½¸öÊý×ÖÒªÒ»Ñù¡£¡£¡£
PHP·½·¨£º
PHP code:
$u="insert user values('','$name','$psw')";
$rs=mysql_query($u);
$id=mysql_insert_id();
$a="insert into answer values('','$question','$answer','$id')";
mysql_query($a);
mysql´¥·¢Æ÷£º
SQL code:
mysql> delimiter |
mysql> create trigger insertanswer
-> before insert on user
-> for each row begin
-> insert into answer values('','','','new.id');
-> end;
-> |
[code={php}]
{$sql= "INSERT INTO user (id,username,password)VALUES('',
Ïà¹ØÎÊ´ð£º
¶ÔMYSQLÖд洢µÄXML¸ñʽµÄÊý¾Ý½øÐвéѯ¸üÐÂÒÔ¼°É¾³ýij½áµã´¦ÀíµÄÀý×Ó£¬Çë·¢ÎÒÓÊÏ䣬лл£¬
30367940@qq.com
·¢ËͺóÇë»ØÌû£¬ÊÕµ½¼°½áÌû
ÄãÒªmysql¸ÉÂï?
ÂãÇó¿ÉÒÔ¿¼ÂÇ!
¶¥ÉÏÈ¥
¶Á³öÀ´È»ºóÓÃSimpleXML´ ......
ÎҼǵÃÔÚmysqlÖÐÓиöload data infile Óï¾ä¿ÉÒÔ°ÑwordÎĵµµÄÄÚÈÝ°´Ò»¶¨¸ñʽµ¼ÈëÊý¾Ý¿â£¬ÕâÑùµ¼ÈëµÄÊý¾ÝÀàÐͺÃÏñÖ»ÄÜÊÇÎı¾¸ñʽµÄÊý¾Ý£¬ÇëÎÊÓÐû¸üºÃµÄ·½·¨¿ÉÒÔµ¼ÈëÊý¾Ý¿â¡£
1¡£Èç¹ûÎÒÃÇÒª°ÑÊÔÌâµ¼ÈëÌâ¿â£¬ÄÇà ......
jspÌá½»Ò³±àÂëÊÇUTF-8£¬MYSQL¿âÒ²ÊÇUTF-8,ΪʲôÌá½»ÁËÖÐÎÄ×Ö·ûÔÚÊý¾Ý¿âÀï±ä³ÉÂÒÂëÁËÄØ£¿
ÕâÖÖÎÊÌâÔõô½â¾ö£¿Ð»Ð»
ÁíÍ⣬JSPµ¯³ö¶Ô»°¿ò£¨±ÈÈ絯³ö¡°XXXÉóºËͨ¹ý¡±ÏÂÃæ¸úÈ·¶¨°´Å¥£©ºÍ·µ»ØÉÏÒ»Ò³ÒÔ¼°×ªµ ......
ÈçÌ⣬ÕâÈý¸öÔÚwin7ÏÂʹÓûáÓÐʲô¼æÈÝÐÔÎÊÌâÂð£¿
ÓÉÓÚÎÒ×î½üÔÚʹÓÃwin7£¬¾ÍÀÁµÃ½øxpÁË£¡
×Ô¼ºÓÃwindows 2008ÓÐÒ»Äê¶àÁË£¬Ã»³öÏÖÈκÎÎÊÌâ¡£
win7²âÊÔ°æÒ²Óùý£¬²»»áÓÐʲôÎÊÌâµÄ£¬·ÅÐÄ¡£
µ±È»Äã×î ......
mySql5.1µÄ mysql command line clientÃüÁî´°¿Úÿ´ÎÒ»µãËü,Ëü¾ÍÒ»ÉÁ¶ø¹ý,²»»áÏÔʾÁË.ÕâÊÇʲôÎÊÌâ?
ÔÚÄãµÄWINDOWSÉÏ£¬ÏÈ°´ [¿ªÊ¼], È»ºó [ÔËÐÐ] ,ÊäÈë cmd È»ºó»Ø³µ
È»ºóÔÙÔÚÕâ¸öDOS´°ÌåÖУ¬ cd C:\Program ......