“解析错误:语法错误,意外T_STRING”

时间:2012-12-07 12:32:43

标签: php syntax

我一直收到一个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 />';


    }
    }

    }
    }


    ?>
            

1 个答案:

答案 0 :(得分: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