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 />';
}
}
}
}
?>
mysql_*
functions in new code. They are no longer maintained and the deprecation process has begun on it. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial. – j0k Dec 7 '12 at 12:34on line 157
? – GBD Dec 7 '12 at 12:36}
. try to remove last}
– GBD Dec 7 '12 at 12:37