0

我不断收到 Parse 错误:语法错误,意外的 T_STRING,我不确定为什么我一直收到它,它是针对第 157 行的搜索查询,

这是全部代码,在我尝试了您的建议后,它不断出现不同的错误。

echo ' <a href="details.php?ID=' . $row['AttractionID'] . '"><img  src="'. $row['ImageUrl'] . '" id="img_rest" /></a><br/>';

提前喝彩

<?php

    $button = $_GET ['submit'];
    $search = $_GET ['search']; 

    if(!$button)
    echo "you didn't submit a keyword";
    else
    {
    if(strlen($search)<=1)
    echo "Search term too short";
    else{
    echo "You searched for \"<strong>$search</strong>\" <hr />";
    mysql_connect("localhost","wd","wd");
    mysql_select_db("leedsattractions");

    $search_exploded = explode (" ", $search);

    foreach($search_exploded as $search_each)
    {
    $x++;
    if($x==1)
    $construct .="name LIKE '%$search_each%'";
    else
    $construct .="AND name LIKE '%$search_each%'";

    }

    $construct  = "SELECT * FROM Attraction WHERE $construct" ;

    $run = mysql_query($construct);

    $foundnum = mysql_num_rows($run);

    if ($foundnum==0)
    echo "No results found for \"<strong>$keywords</strong>\" <hr />";
    else
    {
    echo "\"<strong>$foundnum</strong>\" results found !";

    while($row = mysql_fetch_assoc($run))
    {

        echo ' <a href="details.php?ID=' . $row['AttractionID'] . '"><img src="'. $row['ImageUrl'] . '" id="img_rest" /></a>';
        echo ' <div class="img_rst">';
        echo ' <h2><a href="details.php?ID=' . $row['AttractionID'] . '">' . $row['Name'] . '</a></h2>'; 
        echo ' <p>' . $row['TypeName'] . '</p>';
        echo ' <p>' . $row['Summary'] . '</p>';
        echo ' <h2>' . $row['Postcode'] . '</h2>';
        echo ' </div>'; 
            echo ' <hr />';


    }
    }

    }
    }


    ?>
            
4

1 回答 1

1
    echo " <a href='details.php?ID='" . $row['AttractionID'] . "'><img  src='". $row['ImageUrl'] . "' id='".$img_rest."' /></a><br/>";

you can repeat the id of image 
于 2012-12-07T12:39:46.377 回答