doufei8691 2012-11-07 15:12 采纳率: 100%
浏览 11
已采纳

PHP链接只传递部分mysql结果

OK i have a php link which is made up of several variables

<a href=\year.php? manufacturer='.$manufacturer.'&fuel_type='.$fuel_type.'&model_type='.$model_type.'>'.$model_type.'</a>

The whole code is really long as it has a lot of pagination, so i will just include the basic query and the loop part.

$query1 = "SELECT Distinct model_type from $tableName where manufacturer='$manufacturer' AND fuel='$fuel_type' LIMIT $start, $limit";
$result = mysql_query($query1);

And then the bottom part where i get and show the results.

 $count = 0;
 $max = 2;
 while($row = mysql_fetch_array($result))
    {
$model_type = $row['model_type'];               
$count++;
echo '<td class="manu"><div align="center">'.'<a href=\year.php?    manufacturer='.$manufacturer.'&fuel_type='.$fuel_type.'&model_type='.$model_type.'>'.$model_type.'</a>'.'</div></td>';

 if($count >= $max){
  //reset counter
   $count = 0;
  //end and restart
  echo '</tr><tr>';
  }

  }

now this works fine except when i take the mode type variable from the database it shows as 1 series, however when it is passed in this link it only gets the 1 and doesn't pick up the series.

Thanks

  • 写回答

2条回答 默认 最新

  • dsu5188 2012-11-07 15:22
    关注

    I am not shure but you probably have a missing encoding Problem.

    try this:

    <a href="\year.php? manufacturer='.urlencode($manufacturer).'&fuel_type='.urlencode($fuel_type).'&model_type='.urlencode($model_type).'">'.$model_type.'</a>
    

    Its url_encoding the values so your url doesnt get broken by ',",spaces and so on.

    additional Hint: Enclose your URL with " or ' so you do not get problems at the end.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答