我必须从table workplan_progress中获取所有行并将其插入另一个表exco。我使用过这段代码却没有结果。 exco表中没有数据可见。我也尝试了很多其他方法,但根本没有得到答案。
include("includes/connect.php");
$id=$_GET['id'];
$sql="SELECT * FROM workplan_progress where id='$id'";
$query=mysql_query($sql);
$row=mysql_fetch_array($query, MYSQL_ASSOC);
$value1 = $row['division_name'];
$value2 = $row['division_chief'];
$value3 = $row['period'];
$value4 = $row['month'];
$value5 = $row['activity_name'];
$value6 = $row['unit'];
$value7 = $row['weightage'];
$value8 = $row['per_100'];
$value9 = $row['per_75'];
$value10 = $row['per_50'];
$value11 = $row['per_<50'];
$value12 = $row['measurement'];
$value13 = $row['score'];
$value14 = $row['progress'];
$value15 = $row['indicator_measure'];
$sql1 = "INSERT INTO 'exco' SET division_name='$value1',
division_chief='$value2',
period='$value3',
month='$value4',
activity_name='$value5',
unit='$value6',
weightage='$value7',
per_100='$value8',
per_75='$value9',
per_50='$value10',
perless50='$value11'
measurement='$value12'
score='$value13'
progress='$value14'
indicator_measure='$value15'
";
$query1 = mysql_query($sql1);
if(isset($query1)){
$_SESSION['msg']='This work progress has been forwarded to exco for approval.';
}
echo "<script>window.location='admin_workprogress.php?msg=success'</script>";
&GT?;
答案 0 :(得分:0)
这里有表格名称的单引号:
$sql1 = "INSERT INTO 'exco' SET
您需要的是没有单引号:
$sql1 = "INSERT INTO exco SET
或更好,这与反叛:
$sql1 = "INSERT INTO `exco` SET