douji9734 2012-12-31 20:50
浏览 124

使用PHP将HTML表单值插入ORacle数据库

I have a PHP page in which I display an HTML form, once the form is ready to be submitted, I want to upload it into an Oracle database using the PHP section of the page, which I've included below.

However, I'm not sure what I'm doing incorrectly, I check the database and I am not getting any data loaded on, but I am also not getting any errors on the screen.

Can anyone help me by showing me how to properly upload HTML form data to an Oracle DB using PHP?

Can somebody point out what would cause my code to not work?

Thank you.

<?php
require_once ("xmlrpc.inc");
require_once ("globals.php");
class form
{
    public static function run()
    {
      ini_set('display_errors', 'On');
      error_reporting(E_ALL | E_STRICT);

      $conn = oci_connect("username", "password", "path/to");
      if (!$conn) 
      {
        $m = oci_error();
        echo $m['message'], "
";
        exit;
      }
      else 
      {
        //print "You are connected to the VTC database!<br/>";
      }

      $issueType = $_POST['issueType'];
      $summary = $_POST['summary'];
      $endPointName = $_POST['endPointName'];
      $contactFirstName = $_POST['contactFirstName'];
      $contactLastName = $_POST['contactLastName'];
      $contactEmail = $_POST['contactEmail'];
      $contactPhone = $_POST['contactPhone'];
      $description = $_POST['description'];
      $solution = $_POST['solution'];
      $ticketNumber = $_POST['ticketNumber'];
      $resolved = $_POST['resolved'];
      $agency = $_POST['agency'];

      $insert = 'INSERT INTO VTC_HELPDESK_ISSUES(ISSUE_TYPE,ISSUE_SHORT,ENDPOINT_NAME,CONTACT_FIRST_NAME,CONTACT_LAST_NAME,CONTACT_EMAIL,CONTACT_PHONE,ISSUE_DESC,SOLUTION,OTHER_COMPANY_TICKET_NUM,RESOLVED,AGENCY) '.
             'VALUES(:issueType, :summary, :endPointName, :contactFirstName, :contactLastName, :contactEmail, :contactPhone, :description, :solution, :ticketNumber, :resolved, :agency)';

      $send = oci_parse($conn, $insert);

      //Binding makes it harder to submit anything directly to the Oracle DB
      oci_bind_by_name($send, ':issueType', $issueType);
      oci_bind_by_name($send, ':summary', $summary);
      oci_bind_by_name($send, ':endPointName', $endPointName);
      oci_bind_by_name($send, ':contactFirstName', $contactFirstName);
      oci_bind_by_name($send, ':contactLastName', $contactLastName);
      oci_bind_by_name($send, ':contactEmail', $contactEmail);
      oci_bind_by_name($send, ':contactPhone', $contactPhone);
      oci_bind_by_name($send, ':description', $description);
      oci_bind_by_name($send, ':solution', $solution);
      oci_bind_by_name($send, ':ticketNumber', $ticketNumber);
      oci_bind_by_name($send, ':resolved', $resolved);
      oci_bind_by_name($send, ':agency', $agency);

      oci_execute($send);
    }
}
?>
  • 写回答

1条回答 默认 最新

  • dongting7352 2013-01-02 13:57
    关注

    You are inserting a value that is not allowed in the table or maybe you made a typo with table or column names. Like Mat said, echo the oci_error if oci_execute failed

    if (! oci_execute($send)) {
        var_dump(oci_error()); 
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。