[thelist] PHP: Insert or Replace (upon duplicate IP)

AtdtXav atdtxav at yahoo.com
Tue Apr 9 02:23:01 CDT 2002


explanation:

I can successfully INSERT new data into my table (ptmratings).
However, I don't want someone with the same IP adding multiple
ratings.  Can anyone direct me to code that checks for a
duplicate and if none is found, inserts a new row?

here's my 'pseudocode', sort of:

SELECT $same_ip_row where IP = $Current_IP;
if ( exist($same_ip_row) // 0r maybe if != 0
  UPDATE ip, email, comment, host, user_agent, rating where
IP=$Current_IP;
else
  INSERT ip, email, comment, host, user_agent, rating;

Thanks in advance
Scott

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/



More information about the thelist mailing list