【新手求助】插表问题
$query11 = "select last_insert_id()";
$result11 = mysql_query($query11);
$row = mysql_fetch_row($result11);
$id = $row[0];
$user = "xxx";
$type = "yyy";
$time = date("Y-m-d H:i:s");
echo "<p>$id | $user | $type | $time</p>";
/*
到这为止 输出正常
这是输出
41 | xxx | yyy | 2012-08-18 14:56:43
*/
$query2 = "insert into finding values($id, $user, $type, $time)";
$result2 = mysql_query($query2);
紧接着的这两句执行之后怎么也插不到finding表中,
如果只插字符串可以,比如说$query2 = "insert into finding values($id, 'xxx', 'yyy', '2000-00-00 00:00:00')";
之后mysql_query($query2);没问题
求助各路大神!
这是表结构
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(8) | NO | PRI | NULL | |
| user | varchar(4) | NO | | NULL | |
| type | varchar(40) | NO | | NULL | |
| time | datetime | NO | | NULL | |
+-------+-------------+------+-----+---------+-------+
------解决方案--------------------
values($id, '$user', '$type', '$time')";这样试试