Re: Inserting the clients IP into a table

From: Date: Wed, 27 Dec 2000 02:37:32 +0000
Subject: Re: Inserting the clients IP into a table
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-5442@lists.php.net to get a copy of this message
use mysql's REPLACE command. It does an insert or update if the primary key already exists. Dreamvale wrote: > > perhaps you could do this > > set the iphit column to be unique. > do an insert, and if the ipaddy already exists, no records will be inserted, > and return result will not be true. > > dreamvale > > ----- Original Message ----- > From: "Mattias Johansson" <smart@smartsmartsmart.com> > To: <php-db@lists.php.net> > Sent: Wednesday, December 27, 2000 8:00 AM > Subject: [PHP-DB] Inserting the clients IP into a table > > > Dear group - fast question from a newbie: > > > > How do I insert the IP of the client into a MySQL database? This is going > to > > be used for a do-not-vote-twice mechanism) The IP shall overwrite the cell > > if there is any info... I try to use this code, but it does not seem to > > work: > > > > $ipaddy=getenv(REMOTE_ADDR); > > mysql_query("UPDATE phpDownloads SET iphit = $ipaddy WHERE DownloadID = > > $did"); > > > > Please help - I'm very stuck. > > /Mattias > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- $_ = 'George Schlossnagle'; s#.#(ord$')-(ord$&)+((index($_,$')-$&)?1002:0)#ego;s#-#((substr($],4,1)-6)?67:$-[0])#eog;$:=$_;print join('',(map chr$_,reverse map{substr($:,(3*$_),3)+(11,-109,-14,94,-894,-28,-61,-202,-417,83,-20,-678,53,96,4,-494,82,-869,-826,24,16,-684,-450,-27)[$_]}(0...length($_)/3)),chr(length($_)/2+ord$/),$/);

« previous php.db (#5442) next »