我使用 mysql 创建了表。我试图用我的 php 代码填充它们。如果我的表是空的并且我尝试插入它会给出错误,但如果我最初使用我的 sql 添加之后我的插入工作完美。我花了几个小时但我无法解决它..我该如何解决这个问题再次感谢
注意:未定义的索引:
if (isset($_POST['action']) && $_POST['action']=='submitted') {
$project_id = $_POST['project_id'];
$title= $_POST['title'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$parent_project_id = $_POST['parent_project_id'];
$is_completed= $_POST['is_completed'];
$completion_date= $_POST['completion_date'];
$user_id= $_POST['user_id'];
$iproject_id = $_POST['iproject_id'];
$ititle= $_POST['ititle'];
$istart_date = $_POST['istart_date'];
$iend_date = $_POST['iend_date'];
$iparent_project_id = $_POST['iparent_project_id'];
$iis_completed= $_POST['iis_completed'];
$icompletion_date= $_POST['icompletion_date'];
$iuser_id= $_POST['iuser_id'];
if (isset($_POST['update'])) {
$selected = $_POST['selected'];
if (isset($_POST['insert'])) {
$query = "INSERT INTO project (project_id,title,start_date,end_date,parent_project_id,is_completed,completion_date,user_id) VALUES ($iproject_id,'$ititle','$istart_date','$iend_date',$iparent_project_id,$iis_completed,'$icompletion_date',$iuser_id)";