One other thought - if there is supposed to be one "canonical" home photo you might want to consider a separate column in the table, just to hold the URL of that photo.
HTH, ~Ray
Main Topics
Browse All TopicsThe loop below is supposed to search 2 different databases for a home photo and return the home photo for each listing. I can't figure out why I may get the same photo 3 or 4 times. What is wrong with this code?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Got it figured out the best I can. There was some trouble distinguishing which picture to use in the instance where both tables had a photo. Below is what I came up with:
while ($row = mysql_fetch_array($result)
$SUBDIVISION = $row['SUBDIVISION'];
if (isset($row['ELEM_SCHOOL']
if (isset($row['MIDDLE_SCHOOL
if (isset($row['HIGH_SCHOOL']
$numberofsub = $row['cnt'];
$MAX_PRICE = $row['MAX_PRICE'];
$MIN_PRICE = $row['MIN_PRICE'];
$MLS_ACCT = $row['MLS_ACCT'];
$ZIP = $row['ZIP'];
$CITY = $row['CITY'];
$rets = @mysql_query("SELECT CONCAT(\"http://path/to/fi
while($a = mysql_fetch_array($rets)) { $rets_cnt = $a['cnt']; if ($rets_cnt > 0) { $IMGURL = $a['url']; } }
$ddata = @mysql_query("SELECT UDF_PHOTO0 FROM table WHERE MLS_ACCT = $MLS_ACCT");
while($b = @mysql_fetch_array($ddata)
$ddata_array = explode(",",$UDF_PHOTO0);
if ($rets_cnt <= 0) { if (isset($ddata_array[0])) {$IMGURL = "http://path/to/file/$ddat
if (isset($SCHOOL)) {$SUBDIVISION = $SCHOOL;}
$MAKE_URL = "search_".$city."_".$uvar.
include ('search_engine_lists.php'
$i++;
}
Thanks for your help :)
Business Accounts
Answer for Membership
by: Ray_PaseurPosted on 2009-07-27 at 13:04:37ID: 24955412
There is nothing that jumps out at me as "wrong" in the code, except possibly the reuse of the variable $row1. You might try changing that. If that does not fix it, it is probably a data-dependent error. Consider using var_dump() to print out the arrays as they are retrieved from the query results set.