insert contacts into database but does not want to duplicate already existing contact.
        Posted  
        
            by 
                Frank Nwoko
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Frank Nwoko
        
        
        
        Published on 2011-01-15T20:48:56Z
        Indexed on 
            2011/01/15
            20:53 UTC
        
        
        Read the original article
        Hit count: 172
        
php
I am trying to insert contacts into database but does not want to duplicate already existing contact.
Not sure INSERT has WHERE CLAUSE.
Any ideas?
//Insert INTO contact database
$user_id = userid;
$sql_insert = "INSERT into `jt_members_external_contacts`
            (`j_user_id`,`contact_email`,`firstname`
            )
            VALUES
            ('$user_id','$email','$name') WHERE j_user_id !=$user_id AND contact_email != $email;";
© Stack Overflow or respective owner