View Full Version : eregi sentence parse error?

07-07-2005, 10: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?

07-07-2005, 06: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
// no, ".pdf" is NOT in the string