为什么未将此数据集输入数据库?

时间:2019-02-07 02:43:07

标签: php database mysqli

我的代码片段没有将数据输入数据库时​​遇到问题。有人看到吗?因为我看不到...

如果这很重要,我正在使用000的免费虚拟主机进行测试。

$ConnServ包含在另一个.PHP页面中,并且正在处理对服务器的其他多个请求。所有拼写已被检查多次。该脚本曾经工作过,但它是一个单独的页面。然后将其合并到与HTML表单相同的页面上,以进行“必填字段”检查。

代码抛出零错误。

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<!-- this was included to show how the form interacts with the below code. -->
//Add Table Data
$sql = $ConnServ->prepare("INSERT INTO TestingDatabase (file,fileTwo,text,textTwo,tPos,tPosTwo,owner,createDate,invisible,tags)
VALUES (?,?,?,?,?,?,?,?,?,?)");
$sql->bind_param("ssssiissis",$fileName,$fileName2,$textinput,$textinput2,$textPos,$textPos2,$ContentOwner,$currentDate,$visState,$lineTags);
$sql->execute();
$sql->close();

//echo '<a>'. $fileName . $fileName2 . $textinput . $textinput2 . $textPos . $textPos2 . $ContentOwner . $currentDate . $visState . $lineTags .'</a>'; //<- this will echo the correct data from the form inputs if not commented out.

没有数据输入到数据库字段中,自动增量也未增加,但是所有数据似乎都满足了$sql请求。

如果这很简单,我要去睡觉...

1 个答案:

答案 0 :(得分:1)

您需要使用commit()

提交事务