Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    91
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Cool eregi sentence parse error?

    I have a parse error in eregi sentence.

    PHP Code:
                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
    Code:
    if(eregi("\.pdf", $row[bf_file]) {
    What am i missing?

  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    are you simply looking for ".pdf" in $row['bf_file'] ? if so then you do not want/need regex:
    PHP Code:
    if (strpos($row['bf_file'], '.pdf') !== false)
    {
        
    // yes, ".pdf" is in the string    
    }
    else
    {
        
    // no, ".pdf" is NOT in the string



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •