On Sat, Sep 8, 2012 at 10:49 AM, Stuart Dallas <stu...@3ft9.com> wrote:
> Is there just one image in the folder that starts with the 9 digit number? In 
> that case it's dead simple (untested code):
> <?php
>   function completeImageFilename($prefix)
>   {
>     $matches = glob('images/property_pics/'.$prefix.'*');
>     return $matches[0];
>   }
>   echo '<img src="'.completeImageFilename($row['MSL_No']).'" />';
> ?>

    Stuart is, as usual, right on.  Rather than do the filesystem
handlers and loops, you should definitely consider glob().  Not only
is it quicker, cleaner, and easier to use, but it's far less
resource-intensive than your current implementation.

</Daniel P. Brown>
Network Infrastructure Manager

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to