【发布时间】:2019-08-11 00:03:34
【问题描述】:
我在构建发送到服务的正确 URL 参数时遇到问题。我需要在一个参数中发送动态查询结果。以下是我目前所达到的:
<a href="https://serviceurl/?language=EN&variable1=<?php
$mobiles = array();
while($row_query = mysql_fetch_assoc($query))
{
$data = $row_query['rowwithvalues'];
$myArray = implode(',', $data);
foreach($myArray as $my_Array){
echo $my_Array;
}
}
?>&variable2=Hello">Test</a>
上面的内容为 url 中的 variable1 返回了一个空白值。
提前致谢!
【问题讨论】:
-
您的查询是否成功执行?
mysql_fetch_assoc()也被折旧,也不会执行查询。见mysqli_fetch_assoc() -
能否在脚本中添加调试打印并查看执行了哪个命令?
-
您有一个要发送的变量数组或一个数组变量,并且您想将该数组发送到 1 个变量中?
-
请将
implode改为explode作为第一个返回字符串,并且需要一个数组 -
mysql_fetch_assoc— 危险 这个函数已经被废弃了 年 并且在任何仍然得到安全修复的 PHP 版本中都不可用。