【发布时间】:2014-12-24 09:32:54
【问题描述】:
我需要你的帮助..
我试图从两个表中检索数据并使用 php +mysql 插入另一个表,但它不起作用。它向我显示了这条消息(查询有问题)。
这是我的代码:
$emp_id = $_SESSION['emp_id'];
$from= "select department.name from department,employee where emp_id='$emp_id' and department.dept_id = employee.dept_id ";
$result_form = mysql_query($from);
$dept_from = mysql_fetch_assoc($result_form);
$dept_name = $dept_from['department.name'];
$query = "INSERT INTO Student (date, description, from, emp_id, to)
价值观
(now(),'$_POST[description]','$dept_name','$emp_id','$_POST[to]')";
$result = mysql_query($query);
if(!$result)
{die("Query got problem").(mysql_error());}
else{
【问题讨论】:
-
我在插入查询中看到 2 个保留字为它们使用了反引号
tofrom