gpt4 book ai didi

php - 我无法将数据存储到 MySQL 中

转载 作者:行者123 更新时间:2023-11-30 00:42:33 25 4
gpt4 key购买 nike

所以我有这个表格。我想将数据存储到我的数据库中。然而,事实并非如此,也没有错误日志。我非常感谢您的帮助,因为两天后就要到期,而且我在过去一周左右的时间里一直在努力。

<form enctype="multipart/form-data" action="preview.php" method="post" class="f">
<p>

<p>
<p><label for="name">Teacher's Name:</label>
<input type="text" style="font-family:Gloria Hallelujah" size="35" name="name" id="name" autofocus required></p>
<p><label for="name">Title:</label>
<input type="text" style="font-family:Gloria Hallelujah" size="35" name="title" id="title" autofocus required></p>
<p><label for="done">Done By:</label>
<input type="text" style="font-family:Gloria Hallelujah" size="35" name="done" id="done" required></p>
<p><label for="no">Class:</label>
<input type="text" style="font-family:Gloria Hallelujah" size="15" name="class" id="no" required></p>
<p><label for="sch">School:</label>
<select name="sch">
<option value="seg">School of Engineering (SEG)</option>
<option value="sit">School of Information Technology (SIT)</option>
<option value="sdn">School of Design (SDN)</option>
<option value="sbm">School of Business Management (SBM)</option>
<option value="shs">School of Health Sciences (SHS)</option>
<option value="scl">School of Chemical & Life Sciences (SCL)</option>
<option value="sidm">School of Interactive and Digital Media (SIDM)</option>
</select>

<p><label for="msg">Show your Gratitude! :</label>
<textarea class="tarea" maxlength="3000" cols="38.5" rows="6" name="comments" placeholder="Enter Message here..." required></textarea>
<p class="limit">Char limit: 3000 chars.</p>
</p>

它会转到 preview.php 应该存储数据的地方。

<?php
include "mysqli.connect.php";
include "fbmain.php";

$sql = "INSERT INTO table(teacherName, title, doneBy, studentClass, school, message)VALUES ('$_POST[name]','$_POST[title]','$_POST[done]','$_POST[class]','$_POST[comments]') where facebookId = '".$me['id']."'";

最佳答案

INSERT 命令不需要 WHERE 子句。

P.S:您对SQL Injection持开放态度。 .

关于php - 我无法将数据存储到 MySQL 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21646236/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com