A database for my data

From: Peter (BOUGHTONP) 7 Jun 2012 00:45
To: Ken (SHIELDSIT) 152 of 158
What's wrong with girls names, Gemma?
From: af (CAER) 7 Jun 2012 09:01
To: ALL153 of 158
Personally I'd dump the list of image filenames to a JS array and build the HTML client-side with Mustache, but that's me, I love client-side templating.
From: ANT_THOMAS 7 Jun 2012 12:24
To: ALL154 of 158
Yay I'm rubbish :C Some code
PHP code:
$sold1 = $row[sold];
if ($sold1 == yes){
$soldstring .= "<img alt=\"sold\" src=\"./photos/{$row[thumb]}\" />"; }
else {
$soldstring .= "<img alt=\"notsold\" src=\"./photos/{$row[thumb]}\" />"; }
echoing
PHP code:
" . $soldstring . "
This does as expected for the first result from the DB. But the next result contains the first image as well, and the next one the previous and so on.

So the top result shows correctly, but each result after has extra images, meaning on the 10th result it shows the correct image plus the 9 previous.

Why? :(
From: Drew (X3N0PH0N) 7 Jun 2012 12:27
To: ANT_THOMAS 155 of 158
.= adds to a string, = sets a string. You want = in this case. i.e.:

code:

$sold1 = $row[sold];
if ($sold1 == yes){
$soldstring = "<img alt=\"sold\" src=\"./photos/{$row[thumb]}\" />"; }
else {
$soldstring = "<img alt=\"notsold\" src=\"./photos/{$row[thumb]}\" />"; }
From: ANT_THOMAS 7 Jun 2012 12:28
To: Drew (X3N0PH0N) 156 of 158
(hug)
From: Ken (SHIELDSIT) 9 Jun 2012 16:54
To: Peter (BOUGHTONP) 157 of 158
Nothing at all except he's not a girl like you!
From: Peter (BOUGHTONP) 9 Jun 2012 17:09
To: Ken (SHIELDSIT) 158 of 158
Then who is he a girl like?