ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

11-2-5 °Ñ¤©°Q½×ªº¤å³¹³B²zµ{¦¡

11-2-5 °Ñ¤©°Q½×ªº¤å³¹³B²zµ{¦¡

11-2-5   °Ñ¤©°Q½×ªº¤å³¹³B²zµ{¦¡
·íÂsÄýªÌ¦b¶i¤J¬Y¤@°Q½×¥DÃD¨Ãµoªí°Ñ»P°Q½×ªº·N¨£«á¡]join.php¡^¡A¨ä©Òµoªíªº¸ê®Æ´N·|°e¥æ°Ñ¤©°Q½×¤å³¹ªºµ{¦¡joinnew.php³B²z¡A¦¹µ{¦¡²Ä¤@¥ó­n°µªº¨Æ¬O±N°Q½×¤å³¹ªº¤º®e¼g¤J¨ìSubTitle¡]¦¸¼ÐÃD¡^¸ê®Æªí¤¤¡G
  1. $ID=$_REQUEST["ID"];

  2. //³sµ²MySQL Server
  3.     $conn = mysql_connect("localhost", "root", "12345a");
  4. //¿ï¾Ü¸ê®Æ®w
  5.     mysql_select_db("BBS", $conn);
  6. //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  7.     mysql_query("set character set big5");

  8. //±N³æ¤Þ¸¹¸m´«¬°Âù¤Þ¸¹
  9. Function chgStr($data)
  10. {
  11.    $chgStr = "'" . str_replace("'", "''", $data) . "'";
  12.    return $chgStr;
  13. }

  14. //±N¸ê®Æ¼g¤J¸ê®Æ®w
  15. $sql = "Insert Into SubTitle (©m¦W, Email, ¥DÃD, ¤º®e, ¥D½s¸¹, µoªí¤é´Á) Values (";
  16. $sql = $sql . chgStr($_REQUEST["©m¦W"]) . ",";
  17. $sql = $sql . chgStr($_REQUEST["Email"]) . ",";
  18. $sql = $sql . chgStr($_REQUEST["¥DÃD"]) . ",";
  19. $sql = $sql . chgStr(nl2br($_REQUEST["¤º®e"])) . ",";
  20. $sql = $sql . $ID . ",'";
  21. $sql = $sql . date("Y-m-j H:i:s") . "')";
  22. mysql_query($sql);
½Æ»s¥N½X
½Ð¹ï·Ó¤W¦Cªºµ{¦¡½X¡G

  • µ{¦¡½X²Ä18»P23¦æ¡A¥D½s¸¹»P$ID¡G$ID´N¬O§Ú­Ì¦b°Ñ»P¥Ø«e¥DÃD°Q½×ªºµo¨¥ªí³æ©Ò¶Ç°e¥Ø«e°Q½×¥DÃDªº¡y¥D½s¸¹¡zÁôÂÃÄæ¦ì­È¡A¨ä¥Øªº¬O¥Î¨Ó§@¬°MainTitle¡]¥D¼ÐÃD¡^»PSubTitle¡]¦¸¼ÐÃD¡^¸ê®Æªíªº¡y¥D±q¯Á¤Þ¡z¡C
  • µ{¦¡½X²Ä22¦æ¡A±N°Q½×¤º®e§Q¥Îmysql_query()¨ç¼Æ¼g¤J¸ê®Æ®w¡C


¹Ï11-36   ¡y½g¼Æ¡zÄæ¦ì¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

§Ú­Ì¥´¶}¥D¼ÐÃD¸ê®Æªí­n§ó·s¡u½g¼Æ¡vÄæ¦ìªº¸ê®Æ­È¡A·íµM­n¥ý§ä¥X¯S©w¥DÃDªº¸ê®Æ¿ý¹Æ¡I¦]¦¹¡A§Ú­Ì­n¦b¶}±Ò¸ê®Æªíªº¦P®É¡A¥[¤W¡y"Where ¥D½s¸¹¡×" . $ID¡z¤~¦æ¡]ID´N¬Oµo¨¥ªí³æ¤¤ªºÁôÂÃÄæ¦ì­È¡^¡A¦pªG§Ú­Ì¨S¦³¥[¤W³o­Ó±ø¥ó¦¡¡A«hMainTitle¡]¥D¼ÐÃD¡^¸ê®Æªí¤¤©Ò¦³¸ê®Æ¿ýªº¡y½g¼Æ¡zÄæ¦ì³£·|³Q§ó·s¸ê®Æ³á¡I
  1. //§ó·s¦^Âнg¼Æ        
  2. $SQL = "Update MainTitle set ½g¼Æ=½g¼Æ+1 Where ¥D½s¸¹=" . $ID;
  3. mysql_query($SQL);
½Æ»s¥N½X
joinnew.php
  1. <?
  2. $ID=$_REQUEST["ID"];

  3. //³sµ²MySQL Server
  4.     $conn = mysql_connect("localhost", "root", "12345a");
  5. //¿ï¾Ü¸ê®Æ®w
  6.     mysql_select_db("BBS", $conn);
  7. //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  8.     mysql_query("set character set big5");

  9. //±N³æ¤Þ¸¹¸m´«¬°Âù¤Þ¸¹
  10. Function chgStr($data)
  11. {
  12.    $chgStr = "'" . str_replace("'", "''", $data) . "'";
  13.    return $chgStr;
  14. }

  15. //±N¸ê®Æ¼g¤J¸ê®Æ®w
  16. $sql = "Insert Into SubTitle (©m¦W, Email, ¥DÃD, ¤º®e, ¥D½s¸¹, µoªí¤é´Á) Values (";
  17. $sql = $sql . chgStr($_REQUEST["©m¦W"]) . ",";
  18. $sql = $sql . chgStr($_REQUEST["Email"]) . ",";
  19. $sql = $sql . chgStr($_REQUEST["¥DÃD"]) . ",";
  20. $sql = $sql . chgStr(nl2br($_REQUEST["¤º®e"])) . ",";
  21. $sql = $sql . $ID . ",'";
  22. $sql = $sql . date("Y-m-j H:i:s") . "')";
  23. mysql_query($sql);

  24. //§ó·s¦^Âнg¼Æ        
  25. $SQL = "Update maintitle set ½g¼Æ=½g¼Æ+1 Where ¥D½s¸¹=" . $ID;
  26. mysql_query($SQL);
  27.          
  28. header("Location: join.php?ID=" . $ID);
  29. ?>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : µÊ®ð¼L¤Ú¤£¦n¡A¤ß¦a¦A¦n¤]¤£¯àºâ¬O¦n¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD