Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过图像超链接传递变量?_Php - Fatal编程技术网

Php 通过图像超链接传递变量?

Php 通过图像超链接传递变量?,php,Php,如何超链接图像并同时传递变量?我的错误代码如下: <?php $result=mysql_query("select serial, name, price from products ORDER BY RAND() LIMIT 3"); while($row=mysql_fetch_array($result)) { echo '<a href="searchedprod

如何超链接图像并同时传递变量?我的错误代码如下:

    <?php
            $result=mysql_query("select serial, name, price from products ORDER BY RAND() LIMIT 3");
            while($row=mysql_fetch_array($result))
            {
                echo '<a href="searchedproduct.php?product_id=<?=$row['serial']?>"><img src="getImage.php?id=' . $row['serial'] .'"/></a>'.'&nbsp;'.'&nbsp;';
}

echo "</tr>";
echo "</table>";
?>


感谢大家的帮助,就像宙斯之书所说的,你有一个语法错误:

<?php
$result=mysql_query("select serial, name, price from products ORDER BY RAND() LIMIT 3");
    while($row=mysql_fetch_array($result))
    {
        echo '<a href="searchedproduct.php?product_id='.$row['serial'].'"><img src="getImage.php?id=' . $row['serial'] .'"/></a>'.'&nbsp;'.'&nbsp;';
    }

echo "</tr>";
echo "</table>";
?>


您的
echo'中有语法错误,我看不出有错误,如果您不介意,请您指出给我看!谢谢