【发布时间】:2012-02-26 10:48:27
【问题描述】:
为什么这个简单的插入不起作用?唯一没有插入的值是 $streamName,如果我从代码中删除该值,那么一切正常,代码如下:
$userId= $_SESSION['kt_login_id'];
$streamName= $_GET['streamName'];
$streamDuration= $_GET['streamDuration'];
$recorderId= $_GET['recorderId'];
$con = mysql_connect("localhost","wwwmeety_staff","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("wwwmeety_ourstaff", $con);
mysql_query("INSERT INTO recordedvideos (user_id, streamName, record_duration, recorder_id)
VALUES ($userId, $streamName, $streamDuration, $recorderId)");
mysql_close($con);
和 MySQL 导出
CREATE TABLE IF NOT EXISTS `recordedvideos` (
`record_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`streamName` text,
`record_duration` text,
`recorder_id` text,
PRIMARY KEY (`record_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
【问题讨论】:
-
另一件事值传递给该文件,因为我在 firebug 中检查过,以下是值:
-
您收到什么错误信息? (
mysql_errno()和mysql_error()返回什么?) -
已排序。我忘了用引号将字符串括起来。