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

“解析错误:语法错误,意外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 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 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型