...

View Full Version : eregi sentence parse error?



hanpedro
07-07-2005, 11:58 AM
I have a parse error in eregi sentence.


for ($i=1; $i<=1; $i++) {
$row = sql_fetch(" select hd_file, hd_source from $aa[table_a] where hd_table = '$hd_table' and hd_id = '$hd_id'");
echo $row[hd_file] . "<p>";
if(eregi("\.pdf", $row[bf_file]) {
echo "<iframe src='$hd_table/$row[hd_file]' width='700' scrolling='no' frameborder='0' marginwidth='0' marginheight='0'></iframe>";
}
}{

The line is containing

if(eregi("\.pdf", $row[bf_file]) {

What am i missing?

devinemke
07-07-2005, 07:31 PM
are you simply looking for ".pdf" in $row['bf_file'] ? if so then you do not want/need regex:


if (strpos($row['bf_file'], '.pdf') !== false)
{
// yes, ".pdf" is in the string
}
else
{
// no, ".pdf" is NOT in the string
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum