在另一个PHP页面中打印$\u GET值
我有以下几点。我的问题是当点击在另一个PHP页面中打印$\u GET值,php,Php,我有以下几点。我的问题是当点击index.php上的“购买”链接时,paynow.php页面上没有显示任何内容。我哪里出错了 附言:单价很好。所以我知道从SQL数据库中提取数据是没有问题的 index.php $sql_content = "show columns from cameras"; $get_res = mysql_query($sql_content); $cols = mysql_num_rows($get_res); $page = $_REQUEST['page']; $s
index.php
上的“购买”链接时,paynow.php
页面上没有显示任何内容。我哪里出错了
附言:单价
很好。所以我知道从SQL数据库中提取数据是没有问题的
index.php
$sql_content = "show columns from cameras";
$get_res = mysql_query($sql_content);
$cols = mysql_num_rows($get_res);
$page = $_REQUEST['page'];
$start = ($page-1)*8;
$sql_content1 = "select * from cameras limit $start,$per_page";
$query = mysql_query($sql_content1);
$j=0;
while ($rows = mysql_fetch_assoc($query))
{
?>
<link href="style1.css" rel="stylesheet" type="text/css" />
<div id='mainFrame'>
<div id='totalFrame'>
<div id='priceX'><b>Rs. </b> <?php echo $rows['unitprice'];?></div><!--pricex-->
<div id='buynow'><a href="paynow.php?id="<?php echo $rows['model']; ?>">Buy</a></div>
</div><!--close total frame-->
</div>
<?php
<?php
print $_GET["id"];
?>
$sql\u content=“显示摄像机中的列”;
$get\u res=mysql\u查询($sql\u content);
$cols=mysql\u num\u行($get\u res);
$page=$\请求['page'];
$start=($page-1)*8;
$sql\u content1=“选择*来自摄影机限制$start,$per\u page”;
$query=mysql\u query($sql\u content1);
$j=0;
while($rows=mysql\u fetch\u assoc($query))
{
?>
卢比。
删除双引号“
在开始之前,您应该立即停止使用任何mysql函数。请查看以下内容:
该接口现在已被弃用,您应该使用PDO_MySQL或MySQLi
您的代码中还有一个潜在的SQL注入漏洞,因为您没有清理SQL查询的输入
对于您的问题,此处突出显示的语法突出显示了您的问题,您的代码中有一个额外的“
:
<div id='buynow'><a href="paynow.php?id="<?php echo $rows['model']; ?>">Buy</a></div>
应该是这样的:
<div id='buynow'><a href="paynow.php?id=<?php echo $rows['model']; ?>">Buy</a></div>
删除
双引号“
dovar\u dump($rows)
并告诉我们当你点击“购买”链接时,你看到了什么,你收到的完整URL是什么?在while($rows=mysql\u fetch\u assoc($query))的下方放置:
并告诉我们打印出来的内容。@Will我也注意到了。Id是空的。。这是它的样子。”“HTML id在文档中必须是唯一的。你为什么要将样式表链接放入lop…?这会有什么帮助?相信我,我是一个程序员,我看到了你的意思,id=
之后的一个。你的答案很有用。:@DinukaWijesena如果有帮助,你可以随时接受答案:-)我一直在等待时间的流逝:-)
<div id='buynow'><a href="paynow.php?id=<?php echo $rows['model']; ?>">Buy</a></div>
<div id='buynow'><a href="paynow.php?id=<?=$rows['model']; ?>">Buy</a></div>