10-4-2 ¸ê®ÆÀx¦s»Pª¬ºAÅã¥Ü
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1188
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-7
|
10-4-2 ¸ê®ÆÀx¦s»Pª¬ºAÅã¥Ü
10-4-2 ¸ê®ÆÀx¦s»Pª¬ºAÅã¥Ü
Àx¦s³ø¦WªÌ¸ê®Æªºaddpeople.phpµ{¦¡ºô¶¨ä¥ô°È¦³¤T¶µ¡G
1.ÀËÅç¬ã°Q·|ªº¸ê®Æªí¬O§_¦s¦b¡A¦pªG¸Ó¬ã°Q·|¸ê®Æªí¤£¦s¦b¡A«h«Ø¥ß·sªº¬ã°Q·|¸ê®Æªí¡C
2.±N³ø¦WªÌ¸ê®Æ¼g¤J¸ê®Æ®w¡C
3.Åã¥Ü³ø¦Wª¬ºA»P°Ñ¥[ªÌ²M³æ¦Cªí³sµ²¡C
ª`·N¡G§O§Ñ¤F¥ý¦bMySQL Server¤¤«Ø¤@Ó¦W¬°¡uAutoAct¡vªº¸ê®Æ®w³á¡I |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1188
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-7
|
ÀËÅç¸ê®Æªí¬O§_¦s¦b
¦b³ø¦WªÌ¸ê®Æ¼g¤J¬YÓ¬ã°Q·|¸ê®Æªí¤§«e¡A§ÚÌ¥²¶·¥ý§PÂ_¤@¤U¸Ó¸ê®Æªí¬O§_¦s¦b¡A¦pªG¦s¦b´N¥i¥H±N³ø¦WªÌ¸ê®Æª½±µ¼g¤J¹ïÀ³ªº¸ê®Æªí¤¤¡AY¸Ó¸ê®Æªí¤£¦s¦b¡A«h¥²¶·¨Ï¥ÎSQL¤¤ªºDML«ü¥O«Ø¥ß¤@Ó·s¬ã°Q·|¸ê®Æªí¡C
ÁÙ°O±o§Ú̬ã°Q·|¸ê®Æªíªº³W®æ§a¡]ªí10-1¡^¡I«Ø¥ß¸ê®ÆªíªºDML«ü¥O±Ôz¦p¤U¡G- CREATE TABLE [¬ã°Q·|¸ê®Æªí¦W] (
- Name varchar (10) NOT NULL ,
- Email varchar (50) NULL ,
- Company varchar (50) NULL ,
- Tel varchar (20) NOT NULL
- )
½Æ»s¥N½X ¦Óªí³æ¤¤ªº¤U©ÔÄæ¦ì¡yactname¡z©Ò¶Ç»¼ªº¸ê®Æ´N¬O«¥Ì¬ã°Q·|ªº¸ê®Æªí¦WºÙ¡A©Ò¥H¦bPHPµ{¦¡¤¤§Ú̱NDML«ü¥O±Ôz²Õ¦X¦p¤U¡G- $SQL="Create Table " .
- $¬ã°Q·|¸ê®Æªí¦W .
- " (" .
- "Name varchar(10) Not NULL," .
- "Email varchar(50)," .
- "Company varchar(50)," .
- "Tel varchar(20) Not NULL" .
- ")";
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1188
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-7
|
·s¬ã°Q·|¸ê®Æªíªº«Ø¥ß»P§_¡A¨ú¨M©ó¸ê®Æ®w¤¤ªº¦³µL¸Ó¬ã°Q·|¸ê®Æªíªº¦s¦b¡AnÀËÅç¸ê®Æªí¬O§_¦s¦b¥i§Q¥Îmysql_list_tables()»Pmysql_tablename()¨ç¼Æ¡C
mysql_list_tables()¡G¦C¥X¸ê®Æ®w¤¤¥þ³¡ªº¸ê®Æªí¡C- int mysql_list_tables ( string database_name [, int link_identifier])
½Æ»s¥N½X
- database_name¡G«ü©w§ÚÌn¾Þ§@ªº¸ê®Æ®w¦WºÙ¡C
- link_identifier¡G³s½u¥N¸¹¡Amysql_list_tables()¨ç¼Æ¥ut³d¨ú¦^§@¥Î¤¤¸ê®Æ®w¤ºªº¸ê®Æªí¦Cªí¡A¨Ã¨S¦³³sµ²¸ê®Æ®wªº¯à¤O¡A¦]¦¹¡Amysql_list_tables()¨ç¼Æ¥²¶·³z¹L¬YÓ¤w«Ø¥ß¨Ã§¹¦¨¸ê®Æ®w³sµ²ªº¡u³s½u¥N¸¹¡v¡A³oÓ¡u³s½u¥N¸¹¡v¬O¥Ñmysql_connect()¨ç¼Æ©Ò«Ø¥ßªº¡A³oӰѼƥi¥H¤£«ü©w¡A¦bmysql_list_tables()¨ç¼Æ°õ¦æ®É·|¦Û°Ê§ä´M³Ìªñ¥Ñmysql_connect()¨ç¼Æ©Ò«Ø¥ßªº³s½u¡C
mysql_list_tables()¨ç¼Æ¨Ï¥Î°}¦C¶°¦Xªº¤è¦¡¨Ó¦Cªí¨ú¦^ªº¸ê®Æªí¦WºÙ¡C
mysql_tablename()¨ç¼Æ¡G¨ú¥Xµ²ªG¶°¤¤ªº¸ê®Æ®w©Î¸ê®Æªí¦WºÙ¡C- int mysql_ tablename ( int result_identifier, int i)
½Æ»s¥N½X
- int result_identifier¡Gmysql_list_tables()¡Bmysql_list_dbs()¨ç¼Æ©Ò¶Ç¦^¨Óªºµ²ªGID¡]µ²ªG¶°¡^¡C
- i¡G¨ç¼Æ©Ò¶Ç¦^¨Óªºµ²ªGID¸Ìªº¯Á¤Þ¡C
- //ÀËÅç¸ê®Æªí¬O§_¦s¦b
- $testrs=mysql_list_tables("AutoAct");
- if (!($Actname==mysql_tablename($testrs,$Actname)))
- {
- //¸ê®Æªí¤£¦s¦b«h«Ø¥ß
- //¥H¤U²¤
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1188
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-7
|
¥²¶ñÄæ¦ì¬O§_¦³¸ê®Æ¿é¤J
¦b¸ê®Æªí³W¹º®É¡A§Ú̧â©m¦W¡]Name¡^»PÁpµ¸¹q¸Ü¡]Tel¡^Äæ¦ì³]©w¬°¤@©wn¦³¸ê®Æ¿é¤JªºÄæ¦ì¡]Not NULL¡^¡A¤]´N¬O»¡³ø¦W°Ñ¥[¬ã°Q·|ªÌ¤@©wn¿é¤J¥Lªº©m¦W»P³sµ¸¹q¸Ü¡A¦pªG¨S¦³¸ê®Æ¿é¤Jªº¸Ü·|³y¦¨·s¼W¸ê®Æ¿ý®Éµo¥Í¿ù»~¡A©Ò¥H§ÚÌ¥[¤J¤U¦Cªº§PÂ_±Ôz¡G- <?
- //§PÂ_¥²¶ñÄæ¦ì¸ê®Æ¬O§_¬°ªÅ¥Õ
- //Y¥²¶ñÄæ¦ì¸ê®ÆªÅ¥Õ«hªð¦^³ø¦W¶
- if (empty($_REQUEST["Name"]))
- {
- header("Location: index.php?msg=±zèè©m¦W¥¼¶ñ!!");
- exit();
- }
- else if(empty($_REQUEST["Tel"]))
- {
- header("Location: index.php?msg=±zèèÁpµ¸¹q¸Ü¥¼¶ñ!!");
- exit();
- }
- else
- {
- //±µ¦¬¨Ó¦Ûªí³æ¤¤ªº¥²¶ñÄæ¦ì¸ê®Æ
- $Name = $_REQUEST["Name"];
- $Tel = $_REQUEST["Tel"];
- }
½Æ»s¥N½X ¦pªG¥²¶·¿é¤J¸ê®ÆªºÄæ¦ì¨S¦³¿é¤J¸ê®Æ¡A«h±Nºô¶Âà¦V¦^³ø¦Wº¶index.php¡A¦P®É¶Ç»¼¿ù»~°T®§¡C
¹Ï10-24 ³ø¦Wº¶Åã¥Ü¿ù»~°T®§¡C |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1188
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-7
|
¬d¬Ý¤w°Ñ¥[¤Hûªº³sµ²³]p¦P¼Ë¬O±Ä¥Î¡uªí³æ¡v¤è¦¡«Ø¥ß¡A³oÓµ§ªÌ´N¤£¦A¦h»¡¤F¡A°O±o±NFORM¼ÐÅÒ¤¤ªºactionÄݩʳ]©w¬°listpeople.php§Y¥i¡C
addpeople.php- <?
- //§PÂ_¥²¶ñÄæ¦ì¸ê®Æ¬O§_¬°ªÅ¥Õ
- //Y¥²¶ñÄæ¦ì¸ê®ÆªÅ¥Õ«hªð¦^³ø¦W¶
- if (empty($_REQUEST["Name"]))
- {
- header("Location: index.php?msg=±zèè©m¦W¥¼¶ñ!!");
- exit();
- }
- else if(empty($_REQUEST["Tel"]))
- {
- header("Location: index.php?msg=±zèèÁpµ¸¹q¸Ü¥¼¶ñ!!");
- exit();
- }
- else
- {
- //±µ¦¬¨Ó¦Ûªí³æ¤¤ªº¥²¶ñÄæ¦ì¸ê®Æ
- $Name = $_REQUEST["Name"];
- $Tel = $_REQUEST["Tel"];
- }
- //§PÂ_«D¥²¶ñÄæ¦ì'¤½¥q'¸ê®Æ¬O§_¬°ªÅ¥Õ
- if (empty($_REQUEST["Company"]))
- {
- $Company="";
- }
- else
- {
- $Company = $_REQUEST["Company"];
- }
- //§PÂ_«D¥²¶ñÄæ¦ì'E-Mail'¸ê®Æ¬O§_¬°ªÅ¥Õ
- if (empty($_REQUEST["Email"]))
- {
- $Email="";
- }
- else
- {
- $Email = $_REQUEST["Email"];
- }
- $Actname=$_REQUEST["Actname"];
- //³sµ²SQL Server
- $conn = mysql_connect("localhost", "root", "12345a");
- //¿ï¾Ü¸ê®Æ®w
- mysql_select_db("AutoAct", $conn);
- //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
- mysql_query("set character set big5");
- //ÀËÅç¸ê®Æªí¬O§_¦s¦b
- $testrs=mysql_list_tables("AutoAct");
- if (!($Actname==mysql_tablename($testrs,$Actname)))
- {
- //¸ê®Æªí¤£¦s¦b«h«Ø¥ß
- $SQL="Create Table " .
- $Actname .
- " (" .
- "Name varchar(10) Not NULL," .
- "Email varchar(50)," .
- "Company varchar(50)," .
- "Tel varchar(20) Not NULL" .
- ")";
- mysql_query($SQL);
- }
-
- //«Ø¥ß¬d¸ß¦r¦ê¥Î¥H§PÂ_¬O§_«½Æ³ø¦W
- $SQL="Select name From " . $Actname . " Where name='" . $Name . "'";
- $RS=mysql_query($SQL);
- if (!mysql_fetch_array($RS))
- {
- //¦pªG©|¥¼³ø¦W«h¼g¤J³ø¦WªÌ¸ê®Æ
- $sql = "Insert Into " . $Actname . " (name, Email, company, tel) Values ('";
- $sql = $sql . $Name . "','";
- $sql = $sql . $Email . "','";
- $sql = $sql . $Company . "','";
- $sql = $sql . $Tel . "')";
- mysql_query($sql);
- $msg="§A¤w¸g¶¶§Q§¹¦¨<font color=#FF3300>" . $Actname . "</font>¬ã°Q·|³ø¦W";
- }
- else //«½Æ³ø¦W
- {
- $msg="§A¤w¸g³ø¦W¹L<font color=#FF3300>" . $Actname . "</font>¬ã°Q·|";
- }
- mysql_close();
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=big5">
- <title>½u¤W³ø¦W</title>
- </head>
- <body>
- <p align="center"><img border="0" src="tit.gif" width="231" height="40"></p>
- <p align="center"><?=$msg;?></p>
- <hr width="80%" color="#FF9900">
- <form method="POST" action="listpeople.php">
- <p align="center">
- <input type="hidden" value="<?=$Actname;?>" name="Actname">
- <input type="submit" value="¬d¬Ý¤w°Ñ¥[¤Hû"
- style="background-color: #008000; color: #FFFFFF; border-style: groove">
- </p></form>
- </body>
- </html>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1188
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-7
|
¬ã°Q·|³ø¦W¤Hû²M³æºô¶¡Glistpeople.php- <?
- //±µ¦¬¬d¸ß¬ã°Q·|¸ê®Æ
- $Actname=$_REQUEST["Actname"];
- //³sµ²SQL Server
- $conn = mysql_connect("localhost", "root", "12345a");
- //¿ï¾Ü¸ê®Æ®w
- mysql_select_db("AutoAct", $conn);
- //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
- mysql_query("set character set big5");
- //«Ø¥ßSQL©R¥O¦r¦ê
- $SQL="Select * From " . $Actname;
- //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
- $datalist=mysql_query($SQL);
- //¨ú±oÄæ¦ì¼Æ¶q
- $fieldnum=mysql_num_fields($datalist);
- ?>
- <HTML>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=big5">
- <title><?=$Actname;?>¬ã°Q·|³ø¦W¤Hû²M³æ</title>
- </head>
- <BODY>
- <p align="center">
- <img border="0" src="../tit.gif">
- <p Align="Center">
- <font color="#FF9900"><?=$Actname;?>¬ã°Q·|³ø¦W¤Hû²M³æ</font></p>
- <div align="center">
- <center>
- <TABLE Border=1 Cellspacing=1 bordercolor="#800000">
-
- <?
- //¦C¥XÄæ¦ì©ïÀY
- echo "<tr>";
- for ($x=0 ;$x<$fieldnum;$x++)
- {
- echo "<td>" . mysql_field_name($datalist,$x) . "</td>";
- }
- echo "</tr>";
- //¦C¥XÄæ¦ì¸ê®Æ
- //±N¸ê®Æ¿ýÂà´«¬°Äæ¦ì°}¦C¶°¦X
- while ($fielddatas=mysql_fetch_array($datalist))
- {
- //¿é¥XÄæ¦ì¸ê®Æ
- echo "<tr>";
- for ($x=0;$x<$fieldnum;$x++)
- {
- echo "<td>" . $fielddatas[$x] . "</td>";
- }
- echo "</tr>";
- }
- ?>
- </TABLE>
- </center>
- </div>
- <p align="center"><font size="2">
- <a href="index.php">ªð¦^µn¿ý¶</a></font></p>
- </html>
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
- ©«¤l
- 3
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- »´ä
- µù¥U®É¶¡
- 2012-4-28
- ³Ì«áµn¿ý
- 2015-1-23
|
§A¦n, ¤p»xª©¥D, ²{¦b§Ú¥Î¤FPHP6¤§«á, addpeople.php
ªº"$testrs=mysql_list_tables("AutoAct"); " ¤§«á§Ú¦b
©x¤èPHP«ü¥Ü§ï¤Fmysql_list_tables()¦p¤U:
$autoact='autoact';
$SQL="SHOW TABLES FROM $autoact";
$testrs=mysql_query($SQL);
¦ý°õ¦æ«á¥X¤F
Warning: mysql_tablename() [function.mysql-tablename]: Unable to jump to row 0 on MySQL result index 4 in C:\AppServ\www\addpeople.php on line 50
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\addpeople.php on line 66
·Q½Ð±Ð¤p»xª©¥D¤j¤j§Ú¸Ó«ç¼Ë¿ì©O? |
|
Man
|
|
|
|
|
- ©«¤l
- 3
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- »´ä
- µù¥U®É¶¡
- 2012-4-28
- ³Ì«áµn¿ý
- 2015-1-23
|
¤w¸g¸Ñ¨M¤F, ì¨Ó¬O§Ú"¼g¤J³ø¦WªÌ¸ê®Æ"º|¤F¤@¨Ç²Å¸¹, ÁÂÁÂ! |
|
Man
|
|
|
|
|