Hi all,
I have a search results page which is causing me problems that I would like advice on how to rectify if possible.
For my search results I have the following code:
while ($datarow = mysql_fetch_array($result)) {
$id = $datarow['id'];
$pagetitle = $datarow['pagetitle '];
$content = stripslashes($datarow['content']);
if (strlen($datarow["content "]) >= 300) {
$usecontent = substr($content , 0, 300) . "...";
} else {
$usecontent = $content ;
}
echo "<div id=\"searchresult$id\" class=\"resultcontainer\">
<h1><a href=\"mypage.php\">$pagetitle</a></h1>
<p>$usecontent</p>
</div>";
}
mysql_free_result($result);
If a result is found, it displays the Title of the page in which the search criteria has been found and then displays the first 300 characters of that page as a kind of synopsis.
My problem is, it seems that whenever there is an image within the first 300 characters of this content, my page becomes all screwed up and changes the layout of my searchresults.php page so my question is, how would I go about changing my code so that is removes any images from the 300 character synopsis information?
Thanks in advance