我想从我的数据库中使用crud删除所有行,这是我的删除响应页面。 我试着查询删除*,但没有奏效,所以我手动输入了这样的。价值观以未知的指标出现。任何人都可以帮忙,告诉我我做错了什么,或者给我一个更简单的方法吗?crud删除所有行
<?php
include "library.php";
include "database.php";
?>
<?php
//Get data from form
$faculty=$_POST["faculty"];
$date=$_POST["date"];
$modulecode=$_POST["modulecode"];
$moduletitle=$_POST["moduletitle"];
$school=$_POST["school"];
$modulebookcontent=$_POST["modulebookcontent"];
$moduleorganisation=$_POST["moduleorganisation"];
$lrcmaterials=$_POST["lrcmaterials"];
$moduledifficulty=$_POST["moduledifficulty"];
$modulesimilarity=$_POST["modulesimilarity"];
$contentinteresting=$_POST["contentinteresting"];
$previousknowledge=$_POST["previousknowledge"];
$understoodassessmentrequirements=$_POST["understoodassessmentrequirements"];
$assessmentmethod=$_POST["assessmentmethod"];
$markedwork=$_POST["markedwork"];
$ML_interestforsubject=$_POST["ML_interestforsubject"];
$ML_contentclear=$_POST["ML_contentclear"];
$ML_appropriateteachingpace=$_POST["ML_appropriateteachingpace"];
$ML_reachableforadvice=$_POST["ML_reachableforadvice"];
$ML_helpfulfeedback=$_POST["ML_helpfulfeedback"];
$L1_interestforsubject=$_POST["L1_interestforsubject"];
$L1_contentclear=$_POST["L1_contentclear"];
$L1_appropriateteachingpace=$_POST["L1_appropriateteachingpace"];
$L1_reachableforadvice=$_POST["L1_reachableforadvice"];
$L1_helpfulfeedback=$_POST["L1_helpfulfeedback"];
$L2_interestforsubject=$_POST["L2_interestforsubject"];
$L2_contentclear=$_POST["L2_contentclear"];
$L2_appropriateteachingpace=$_POST["L2_appropriateteachingpace"];
$L2_reachableforadvice=$_POST["L2_reachableforadvice"];
$L2_helpfulfeedback=$_POST["L2_helpfulfeedback"];
$moduleleader=$_POST["moduleleader"];
$lecturer1=$_POST["lecturer1"];
$lecturer2=$_POST["lecturer2"];
$indpstudy=$_POST["indpstudy"];
$attendance=$_POST["attendance"];
$bestfeatures=$_POST["bestfeatures"];
$improvemodule=$_POST["improvemodule"];
$queryString = "delete from studentanswers where faculty=".$faculty;
$queryString = "delete from studentanswers where date=".$date;
$queryString = "delete from studentanswers where modulecode=".$modulecode;
$queryString = "delete from studentanswers where moduletitle=".$moduletitle;
$queryString = "delete from studentanswers where school=".$school;
$queryString = "delete from studentanswers where modulebookcontent=".$modulebookcontent;
$queryString = "delete from studentanswers where moduleorganisation=".$moduleorganisation;
$queryString = "delete from studentanswers where lrcmaterials=".$lrcmaterials;
$queryString = "delete from studentanswers where moduledifficulty=".$moduledifficulty;
$queryString = "delete from studentanswers where modulesimilarity=".$modulesimilarity;
$queryString = "delete from studentanswers where contentinteresting=".$contentinteresting;
$queryString = "delete from studentanswers where previousknowledge=".$previousknowledge;
$queryString = "delete from studentanswers where understoodassessmentrequirements=".$understoodassessmentrequirements;
$queryString = "delete from studentanswers where assessmentmethod=".$assessmentmethod;
$queryString = "delete from studentanswers where markedwork=".$markedwork;
$queryString = "delete from studentanswers where ML_interestforsubject=".$ML_interestforsubject;
$queryString = "delete from studentanswers where ML_contentclear=".$ML_contentclear;
$queryString = "delete from studentanswers where ML_appropriateteachingpace=".$ML_appropriateteachingpace;
$queryString = "delete from studentanswers where ML_reachableforadvice=".$ML_reachableforadvice;
$queryString = "delete from studentanswers where ML_helpfulfeedback=".$ML_helpfulfeedback;
$queryString = "delete from studentanswers where L1_interestforsubject=".$L1_interestforsubject;
$queryString = "delete from studentanswers where L1_contentclear=".$L1_contentclear;
$queryString = "delete from studentanswers where L1_appropriateteachingpace=".$L1_appropriateteachingpace;
$queryString = "delete from studentanswers where L1_reachableforadvice=".$L1_reachableforadvice;
$queryString = "delete from studentanswers where L1_helpfulfeedback=".$L1_helpfulfeedback;
$queryString = "delete from studentanswers where L2_interestforsubject=".$L2_interestforsubject;
$queryString = "delete from studentanswers where L2_contentclear=".$L2_contentclear;
$queryString = "delete from studentanswers where L2_appropriateteachingpace=".$L2_appropriateteachingpace;
$queryString = "delete from studentanswers where L2_reachableforadvice=".$L2_reachableforadvice;
$queryString = "delete from studentanswers where L2_helpfulfeedback=".$L2_helpfulfeedback;
$queryString = "delete from studentanswers where moduleleader=".$moduleleader;
$queryString = "delete from studentanswers where lecturer1=".$lecturer1;
$queryString = "delete from studentanswers where lecturer2=".$lecturer2;
$queryString = "delete from studentanswers where indpstudy=".$indpstudy;
$queryString = "delete from studentanswers where attendance=".$attendance;
$queryString = "delete from studentanswers where bestfeatures=".$bestfeatures;
$queryString = "delete from studentanswers where improvemodule=".$improvemodule;
queryDatabase($queryString);
?>
<?php CRUDheader("Delete Student Answers"); ?>
<body>
<div id="main">
<div id="content">
<p>Student answers deleted</p>
</div>
</div><?php CRUDmain(); ?>
</body>
</html>
为什么不使用'TRUNCATE TABLE studentanswers'?如果要选择要删除的特定行,则正确的语法是'DELETE FROM studentanswers WHERE column1 = value1' – Mave
'delete * from'是无效的sql语法。删除不接受字段列表,因为您不能删除单个字段 - 您只能删除整行,这意味着所有字段都会被删除。 '从表中删除'是正确的语法 –
@Mave会截断删除行或表?对不起,我是新手。 – taniakeira