[英]Insert id page on mysql table field
如何在mysql数据库中插入当前页面的编号(ID)?
我有这个查询:
$page = $_REQUEST['id'];
addslashes($page);
$query = "insert into files
(file_id,subid,fname,fdesc,tcid,floc) values ($newstd,'$page','"
. htmlspecialchars($_REQUEST['fname'], ENT_QUOTES) . "','"
. htmlspecialchars($_REQUEST['fdesc'], ENT_QUOTES)
. "','" . $_SESSION['tcid'] . "','"
. htmlspecialchars($_REQUEST['floc'], ENT_QUOTES) . "')";
页面ID就像index.php?ID = 2
I've tried this $page = $_GET['page'];
addslashes($page);
This gets the page value from the url, for example
if you went to index.php?page=LOL it would return LOL
into that $page variable. We now
apply addslashes() to the $page variable
for security reasons, as we are going to be using
this in a MySQL query.
但不起作用。
表配置:
CREATE TABLE IF NOT EXISTS `files` (
`file_id` int(11) NOT NULL,
`floc` varchar(500) NOT NULL,
`fdesc` varchar(100) NOT NULL,
`tcid` int(11) NOT NULL,
`subid` text NOT NULL,
`fname` varchar(100) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=41 DEFAULT CHARSET=latin1;
Subid
是页码。
使用$page = $_REQUEST['ID'];
而不是$page = $_GET['page'];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.