"It also probably doesn't help that I am working on two new things to me at a time, I am screwing this up..I know. "
you said it exactly. unfortunately, this is one of the fastest ways to mess things up... I should know, I do it all the time ;-) I think "well, as long as I'm in here, let me just tweak this other thing" and of course inadvertently, I mess soemthing else up... argh.
here's the easiest way for you to fix this, I guarantee:
get the code working so that it displays every story and photo, without any of teh stuff to look and see if it's the first photo or not. i.e. get it back to its original state, where it functions properly :-)
did I mention that you need to be absolutely sure it's working correctly before you go any further?
add in my code with the flag stuff. note that this will only ADD a couple of lines to your coed... the $flag=0 part outside the main loop, and the if/else statement... nothing else. the while() part of your code will not change.
hey, do you understand the while() part of your code? it's the section that retrieves each row from the database. if that's working, you don't want or need to change it. the modification you're trying to make (where the photo field is displayed the first time thorugh the loop) has everything to do with deciding what to do with the data AFTER retrieving it.
ok, hope that helps. do what I said above, start at #1, get the coed working THEN make the (small) changes to add the logic!
and review this:
while (we get each row of the story) {
if (!$flag) { // if flag is not set, we haven't shown a photo yet
// echo the photo and caption, etc.
$flag = 1; // set the flag so we know we have shown a photo now
} else {
// if we got here, flag was set, it means we have shown a
// photo already on a previous loop through
// don't echo the photo and caption [do nothing]
}
// echo the rest of the story (body text, byline, headline, whatever)
} // end of while() loop
there's not much else I can do to help you here... you are close but you really gotta take it from the top, one step at a time. i feel like you're kind of throwing a bunch of stuff up at once and hoping it'll work when the pieces land; that's just going to leave you frustrated. if you understand your original code, then you should be able to apply my $flag stuff.
best
Eric