A database for my data

From: ANT_THOMAS 6 Jun 2012 21:47
To: Peter (BOUGHTONP) 146 of 158

I agree on the regex front. It seems to have been the fix for loads of stuff I've asked on here.

 

Also (hug) the extra braces worked!

From: Matt 6 Jun 2012 22:23
To: Peter (BOUGHTONP) 147 of 158
It is responsible for adding paragraph tags but obeying valid HTML nesting and tag ordering.
From: Peter (BOUGHTONP) 6 Jun 2012 22:51
To: Matt 148 of 158
Hmm, well must be something else that is stopping PHP being all coloured and stuff then?

In my previous post, there's extra line-breaks there, but in Ant's there aren't any. Might also be related in some way?
From: ANT_THOMAS 6 Jun 2012 22:54
To: Peter (BOUGHTONP) 149 of 158
I disabled them because they were being added extra within the code tags. If I hadn't it would've looked like yours.
From: Peter (BOUGHTONP) 6 Jun 2012 23:10
To: ANT_THOMAS 150 of 158

Ah, thought you might have done. However, it shouldn't be necessary - the line breaks shouldn't get added at all - content between code isn't supposed to be changed (excluding font/colour formatting).

 

Dunno what the cause is though - I did go look at the code Matt referred to and it's far too much effort trying to decipher it all, especially as tired as I currently am.

EDITED: 6 Jun 2012 23:10 by BOUGHTONP
From: Ken (SHIELDSIT) 6 Jun 2012 23:35
To: Peter (BOUGHTONP) 151 of 158
Drew needs to change his nick. Lucy is a girls name.
EDITED: 6 Jun 2012 23:35 by SHIELDSIT
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?