douyi2664
douyi2664
2012-12-07 12:32
浏览 46
已采纳

“解析错误:语法错误,意外T_STRING”[关闭]

I keep getting a Parse error: syntax error, unexpected T_STRING and im not sure why i keep getting it, it is for a search query on line 157,

This is the full lot of code, it kept firing up with different errors after I tried what you suggested.

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

Cheers in advance

<?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条回答 默认 最新

  • dtk31564
    dtk31564 2012-12-07 12:39
    已采纳
        echo " <a href='details.php?ID='" . $row['AttractionID'] . "'><img  src='". $row['ImageUrl'] . "' id='".$img_rest."' /></a><br/>";
    
    you can repeat the id of image 
    
    点赞 评论

相关推荐