2009-12-29 2 views
0

을 수정하는 데 도움이 필요합니다. Dreamweaver cs4 "insert into"기능을 사용하여 단일 페이지에서 여러 양식을 관리하고 있습니다. 테이블 "주식"php/mysql 드림위버 코드

  • 에 양식에서

    1. 데이터를 삽입 새로 추가 된 행
    2. 의 ID를 검색하는 동일한 페이지와의 확인 메시지가 에코는 : 그것은 있도록하지만 난 코드를 편집하는 데 문제가 있어요

      <?php 
      if (!function_exists("GetSQLValueString")) { 
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
      { 
          if (PHP_VERSION < 6) { 
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; 
          } 
      
          $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); 
      
          switch ($theType) { 
          case "text": 
           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
           break;  
          case "long": 
          case "int": 
           $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 
           break; 
          case "double": 
           $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; 
           break; 
          case "date": 
           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
           break; 
          case "defined": 
           $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; 
           break; 
          } 
          return $theValue; 
      } 
      } 
      
      $editFormAction = $_SERVER['PHP_SELF']; 
      if (isset($_SERVER['QUERY_STRING'])) { 
          $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); 
      } 
      
      if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) { 
          $insertSQL = sprintf("INSERT INTO tbl_solicitors (solicitorName, solicitorDetail) VALUES (%s, %s)", 
               GetSQLValueString($_POST['solicitorName'], "text"), 
               GetSQLValueString($_POST['solicitorDetail'], "text")); 
      
          mysql_select_db($database_speedycms, $speedycms); 
          $Result1 = mysql_query($insertSQL, $speedycms) or die(mysql_error()); 
      } 
      ?> 
      
      (참고로) 아이디 여기

    가 포함 된 링크는 단지 (테스트되지 않은) 데이터베이스에 새 행을 추가해야합니다 ... 드림위버 지금까지 내게 주신 것입니다

    도움을 주시면 감사하겠습니다 ... 감사합니다. 새해 복 많이 받으세요!

  • +0

    lol이 게시물은 어떻게 편집 되었습니까? – methuselah

    답변

    0

    걱정하지 마세요 ... 해결책을 찾았습니다 ... 익숙하지 않은 코드를 사용하지 않기로 결정했습니다!

    tho를 확인해 주셔서 감사합니다.

    if (array_key_exists('solicitor',$_POST)) { 
          $solicitorName = $_POST['solicitorName']; 
          echo "The record for <b>$solicitorName</b> has been successfully added to the database.<p> 
          <a href='#' class='form'>View details</a><p> 
          <a href='instructus.php' class='form'>Create a new record</a> 
          "; 
          exit; 
          };