我有一个PHP页面,我在其中显示一个HTML表单,一旦表单准备好提交,我想使用页面的PHP部分将其上传到Oracle数据库,我已经在下面提到了。< / p>
但是,我不确定我做错了什么,我检查数据库,我没有加载任何数据,但我也没有在屏幕上出现任何错误。
有人可以通过向我展示如何使用PHP将HTML表单数据正确上传到Oracle数据库来帮助我吗?
有人可以指出导致我的代码不起作用的原因吗?
谢谢。
<?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'], "\n";
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);
}
}
?>
答案 0 :(得分:0)
您正在插入表格中不允许的值,或者您输入了包含表格或列名称的拼写错误。 就像Mat所说,如果oci_execute失败,则回显oci_error
if (! oci_execute($send)) {
var_dump(oci_error());
}