Using PHP to match table data with images
<p>Hello i would like to make sure I get this code right, and I am really not sure of the syntax.</p>

<p>Here is the situation. I am scanning a directory and echoing its contents as img tags and thumbnails. I also want to match each image up with descriptions and titles which are stored in a table. ('id', 'name', 'title', 'description')</p>

<p>The name of each file in the directory was created with a user generated value, stored as 'name' in the that same table. I want to match each title and description with the file name, and place them in the appropriate place in my img tag and link.</p>

<p>here is the code:</p>

<pre><code>&lt;?php
$connect = mysql_connect ("localhost","root","") or die("couldn't connect :(");
mysql_select_db("cynthieimages") or die("couln't find db :(");

*here I want to pull the data from the table into an $data[]

$handle = opendir(dirname(realpath(__FILE__)).'/images/fullscreen/graphicdesign/logos');
while($file = readdir($handle))
  {
     if($file !== '.' &amp;&amp; $file !== '..')
        {

        *Right in here I need to define $title by exploding $file and geting the first part of the name*
        *Here i want to define $description from $data[] where it shares a row name as $title* 

echo '&lt;a href="images/fullscreen/graphicdesign/logos/'.$file.'" rel="prettyPhoto[pp_gal]" title="'.$description.'"&gt;&lt;img src="images/thumbnails/websitethumbs/graphicdesign/logos/th_'.$file.'" width="60" height="60" alt="'.$title.'" /&gt;&lt;/a&gt;';

       }
   }
?&gt;
</code></pre>

<p>Anyway, that is my thought process... I am not even sure if it will work. Please, you masters of PHP, come to my aid ;)   </p>
