Unwanted exponential display
Posted: Sat Jan 22, 2005 2:24 am
I realize what the error is doing here. I'm just not understanding how to fix it. It is supposed to display each photo related to the MID once in a 3 column table. What it actually does is display each photo as many times as there are photos in the database. For instance, if there were 3 total photos in the database it would display 1, 2, 3, 1, 2, 3, 1, 2, 3. If there were 2 photos it would display 1, 2, 1, 2. An exponential display. Any clues? I'm thinking my SELECT statement isn't isolating the MID but I'm not sure how to do something like this in MySQL.
Code: Select all
function getMembersPhoto(){
Global $connection;
$today = date("Ymd");
$member = $_GETї'MID'];
$numcols = 3; // how many columns to display
$numcolsprinted = 0; // no of columns so far
hookUpDb();
$query = "SELECT t1.*, t3.MemberNum
FROM photos t1, xrefphotomember t2, memberinfo t3
WHERE t3.MID = $member";
$result = mysql_query($query,$connection);
openPhotoTable();
while ($row = mysql_fetch_row($result)){
$PID = $rowї0];
$PhotoNum = unFormatData($rowї1]);
$PhotoDescr = unFormatData($rowї2]);
$MemberNum = unFormatData($rowї4]);
$PhotoURL = "images/cars/". $MemberNum. "-". $PhotoNum. ".jpg";
$Thumb = "images/cars/". $MemberNum. "-". $PhotoNum. "-thumb.jpg";
$OnClick = "onClick="JustSoPicWindow('". $PhotoURL. "','600','451','* * Click screen to close * *','#000000','hug image','0');return document.MM_returnValue"><img src="$Thumb" alt="" width="169" height="127" border="0"></a><br />$PhotoDescr</td>";
$Output = "<td class="memberdata"><a href="javascript:;" ". $OnClick;
if ($numcolsprinted == $numcols) {
print "</tr>\n<tr>\n";
$numcolsprinted = 0;
}
print("$Output");
$numcolsprinted++;
}//end while
$colstobalance = $numcols - $numcolsprinted;
for ($i=1; $i<=$colstobalance; $i++) {
print "<TD class="memberdata"></TD>\n";
}
closePhotoTable();
closeMemberTable();
mysql_free_result($result);
mysql_close($connection);
}