Hi I am trying to display either source1 or source2 thumbnail image but unable to find a solution. Hopefully someone will be able to help. Here is the code I am trying to figure out. $db=mysql_connect ($DB_HOST ,$DB_USER,$DB_PASSWORD) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ($DB_NAME); $num_rows = mysql_num_rows(mysql_query("select * from project")); $result = mysql_query($query) or die ('Query Error: ' . mysql_error()); header("Content-Type: text/xml"); header("Expires: 0"); print "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; print "<ut_response status=\"ok\">\n"; print "<project_list>\n"; while ($results = mysql_fetch_array($result)) { $viewnumber = $results['Views']; $title = $results['title']; $viewkey = $results['screen']; $code = $results['thumbnail']; preg_match('(file=[\"a-z:\/\.\?=\-0-9A-Z_\"]*)',$code,$results); $file = substr($results[0],5,strlen($result[0])-4); $source1 = $file; preg_match('(src=[\"a-z:\/\.\?=\-0-9A-Z_\"]*)',$code,$results); $src = substr($results[0],5,strlen($result[0])-1); $source2 = $src; print "<project>\n"; print "<views>"; print "$viewnumber"; print "</views>\n"; print "<title>"; print "$title"; print "</title>\n"; print "<url>"; print "$viewkey"; print "</url>\n"; print "<thumbnail_url>"; print "$source1"; print "</thumbnail_url>\n"; print "</project>\n"; } mysql_close(); print "</project_list>\n"; print "</ut_response>"; Code (markup): This code works to display thumbnail from source1. How can I make it to display source2? Any help is greatly appreciated.