首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

求准确写法

2012-08-03 
求正确写法直接看代码:PHP codewhile ($rowmysql_fetch_row($result)){for ($i0 $imysql_num_fields($

求正确写法
直接看代码:

PHP code
    while ($row=mysql_fetch_row($result))    {      for ($i=0; $i<mysql_num_fields($result); $i++ )      {        echo '<a href="../products/index.php?pclass=$row[$i]">';//这一行,plass=后面应该怎么写才符合规范?        echo "$row[$i]";        echo '</a>';      }    }


谢谢

[解决办法]
echo "<a href='../products/index.php?pclass=$row[$i]'>";
[解决办法]
Note: 不像双引号 和heredoc语法结构, 在单引号字符串中的变量 和特殊含义的字符将 不会 被替换。
http://www.php.net/manual/zh/language.types.string.php
[解决办法]
echo "<a href='../products/index.php?pclass={$row[$i]}'>";

热点排行