say i have the following html
<table border=0 cellspacing=0 cellpadding=0><tr><td width=100%>
</td></tr></table>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr valign=top><td width=99% valign=top>
<center>Sorry, no news stories were found containing <b>searchstring</b></center>
</td><td> </td><td width=1%>
<center>
<table border=0 cellpadding=3 cellspacing=0 width=180>
now say I have the above html page in a string called $html_string.
If the <center>Sorry, no news stories were found containing <b>searchstring<b></b></center> is found, I want to print out something. the searchstring changes and is dynamic. If this string isn't found in the string, then i just want to continue...so i have tried the following code
$container = "<center>Sorry";
if(strstr($container,$html_string))
{
echo "No News Stories Found";
}
else
{
my other code is here
}
and I have also tried
if (preg_match("/<center>Sorry, no news/", $html_string))
{
echo "Sorry, no news matches were found<br>";
}
else
{
my other code is here
}
yet both of those examples don't appear to work...they always run my other code and don't print out Sorry, no news matches were found
any ideas?