[thesite] new styles for beo, leo, meo, and print

rudy r937 at interlog.com
Mon Feb 26 19:16:23 CST 2001


> ... otherwise the query loops the recordset, grabbing
> userid, getting an email for that and sending an email.
> rather rinse repeat.

ouch!!  ooooh!!  cut it out, man, that HURTS!!

you know those discussions on thelist about content versus presentation?

same deal with queries, you have to separate content from procedure

*never* willingly undertake to do the database's job (procedure)

always state the query in terms of which records you want (content)

what you just said up there sounded as ugly as  <font face=Arial><p><font
face="Comic Sans MS"><b>loops the <i></b>recordset!!</font></i></font></p>

are you doing the looping?  i thought CFMAIL could process the query
results in one statement -- were you perhaps trying to describe this
process?   i would hate to think you are bouncing back and forth between
the cf page and the database, back and forth, back and forth -- which is
what it sounds like you said


> is there some better query to only grab each userid once?

yup, use the DISTINCT keyword in the query

let's do a quick analysis

first, process the add-a-comment form

  insert into replies values ( ... )

the userid for the author of the comment is the logged on user, right?  and
the article id is in the url, right?

okay, assuming that gets done, let's recap what we know

we have the article id of the article, and we know there's at least one
comment on it (the one that was just added), and the comment(s) are from at
least one user (the one that just added the comment), and if there are any
other comments on the article, they could be from any number of users,
including the one that was just added, and any user can have multiple
comments

yeah, use exactly what you have for the where clause --

         WHERE
     users.userid = replies.userid
       AND replies.contentid = 3509
         AND users.userid != 5

just add DISTINCT to the select list

and don't you have to test the notify column to see if the email should go
to each person?


> sorry about being a dumbass, my head is really really really
> foggy and still dripping out bong resin and shit..

whoa, apology not necessary


rudy






More information about the thesite mailing list