PHPÓëMySQL½»»¥Ê¹ÓÃÏê½â
×÷Õß ØýÃû¼¼Êõ
À´Ô´ NET±à³Ì
ä¯ÀÀ
·¢²¼Ê±¼ä 2012-05-24
_updated datetime DEFAULT ''0000-00-00 00:00:00'', flag_deleted enum(''Y'',''N'') DEFAULT ''N'' NOT NULL, script_name VARCHAR(20) NOT NULL,script_size VARCHAR(10) NOT NULL, script_describe VARCHAR(200) NOT NULL,author_name VARCHAR(20) NOT NULL, author_email VARCHAR(20) NOT NULL,author_homepage VARCHAR(30) NOT NULL, primary key (key_script))";$result=mysql_db_query($dbname,$str_sql,$link_id); if ($result){echo"ok! Table $tablename has been created!";}else{echo"Failed!";} ?>OK! ÎÒÃÇµÄ±í½¨ºÃÁË!3¡¢Éú³É²åÈë¼Í¼´úÂë³ÌÐò¡£ËƺõÎÒÃÇÓ¦¸ÃÏȰѼͼÏÔʾ³öÀ´£¬È»ºó²Å²åÈë¼Í¼£¬µ«ÒòΪÎÒÃÇ»¹Ã»Óмͼ£¬ËùÒÔ°ÑÕâÒ»²½ÌᵽǰÃæÀ´¡£ Ê×ÏÈ¡¢´´½¨Ò»¸öHTML±íµ¥£¬ÒÔ±ãÓû§ÊäÈëÏà¹ØÐÅÏ¢¡£Æä´Î¡¢´´½¨ÄܲåÈë±íµ¥ÐÅÏ¢µÄMySQL´úÂë¡£ºÃ£¡ ÎÒÃÇ¿ªÊ¼£¬±íµ¥ÑùʽÈçÏ£º³ÌÐòÃû£ºÎļþ´óС£º³ÌÐòÃèÊö£º×÷ÕßÃû£º ×÷ÕßÓʼþµØÖ·£º×÷ÕßµÄÖ÷Ò³£ºÄܲåÈë±íµ¥ÐÅÏ¢µÄMySQL´úÂëÈçÏÂ:script_insert_action.php<?php require(''connect.inc'');if($arr_request[''action'']==''insert''){ $current_date=date(''Y-m-d H:i:s'');/*°Ñµ±Ç°Ê±¼ä°´YYYY-MM-DD HH:MM:SS·½Ê½ÅÅÁÐ*/ /*ÏÂÃæÒª¶¯Ì¬Éú³ÉSQL´úÂë,ÆäÖÐÎÒÃǶ¨ÒåµÄ×Ô¶¯ÔöÁ¿µÄ×Ö¶ÎÓÉMySQL×Ô¼º²úÉú*/ /*ÁíÍâflag_deleted×ֶεÄÈ´Ê¡ÖµÊÇ"N",ËùÒÔÕâÁ½Ï²»ÐèÒªÎÒÃÇÔÚÕâÀïÌرðÌá³öÀ´*/ /*´ó¼Ò¶¼ÖªµÀ:PHPÑϸñÇø·Öµ¥ÒýºÅ£¨''£©¡¢Ë«ÒýºÅ£¨"£©µÄ×÷Ó᣶øÎÒÃǵÄ×÷ÕßÃûµÈÔÚÊý×éÄÚ*/ /*ÎÒÃÇÒªÕâÑùÒýÓÃÊý×飺$arr_request[''author_name''],×¢ÒâÕâÀïÓе¥ÒýºÅ£¨''£©*/ /*¶øÎÒÃÇÔÚÊäÈëinsertÓï¾äµÄֵʱӦ¸ÃÕâÑù£ºVALUES(''$current_date'') */ /*Èç¹ûÎÒÃDz»È¥´¦ÀíÕâЩ·ÖºÅ£¬¾Í»á³öÏÖÕâÖÖÇé¿ö£ºVALUES(''$arr_request[''author_name'']'') */ /*ÕâÖÖÇé¿öPHPÄÜ´¦ÀíºÃÂ𣿵±È»²»ÄÜ£¬ËùÒÔÎÒÃǵÄÏë·½·¨À´´¦ÀíËü*//*ÕâÀÎÒÃÇÓÃÏÂÃæÕâÖÖ¼¼ÊõÀ´±ÜÃâÕâ¸öÎÊÌ⣻µ±È»ÕâÀﻹÓÐÆäËüµÄ·½·¨¡£ÄúÏÈÏëÏë°É£¡*/ $script_name=$arr_request[''script_name'']; $script_size=$arr_request[''script_size'']; $script_describe=$arr_request[''script_describe'']; $author_name=$arr_request[''author_name'']; $author_email=$arr_request[''author_email'']; $author_homepage=$arr_request[''author_homepage''];/*ÕâÑùÒ»Ìæ»»£¬´¦Àíʱ¾ÍºÃ¶àÁË*/ $str_sql="insert into $tablename(date_created,date_updated,script_name, script_size,script_describe,author_name,author_email,author_homepage)VALUES( ''$current_date'',''$current_date'',''$script_name'',''$script_size'', ''$script_describe'',''$author_name'',''$author_email'',''$author_homepage'')"; $result=mysql_db_query($dbname,$str_sql,$link_id);/* ÏÂÃæ¸øÓû§¼òµ¥µÄÐÅÏ¢·´À¡ */ if (!$result){html_error_exit(''MySQL²åÈëÃüÁîʧ°Ü!'');}else(html_header(''³É¹¦''); echo"<center> ";echo(''MySQL²åÈëÃüÁî³É¹¦'');echo"<br> ";echo"html_footer();)?> OK! ²åÈë¼Í¼¹¦ÄÜÍê³É£¡ |
ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»! |