Jump to content


Photo

Selecting / Doing something for one row-value per row?


  • Please log in to reply
3 replies to this topic

#1 Adastra

Adastra
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 10 July 2006 - 08:33 AM

I've written a new small function to send someone an email when a follow-up comment is made on a bloglike thing, but I would like to send them only ONE e-mail per entry, or per e-mail address, in case they signed up for a follow-up more than once.

How exactly can I do that? I can't think of any function in PHP (I'm still a noob), and I also don't know how to approach this in SQL.
I thought something like "SELECT * FROM blog_comments WHERE entry=$entry AND followup='yes' and COUNT(email) >= 1" might work, but I get an error with that statement.
Anyone got any better ideas? :)

#2 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 10 July 2006 - 09:48 AM

you could add a field to table called "SENT_EMAIL" and mark it true and maybe a date so you can decided if you've sent an email, and how long ago...

#3 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 10 July 2006 - 09:53 AM

Another way would be to store all the emails in an array,  then use the array_unique() function to remove duplicate entries.

You could then send an email to each of those.

#4 Adastra

Adastra
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 10 July 2006 - 01:48 PM

Another way would be to store all the emails in an array,  then use the array_unique() function to remove duplicate entries.

You could then send an email to each of those.

How exactly does that work? Do you have a code sample? Sry, I'm such a noob... ^^




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users