December 2nd, 2000, 06:48 AM
Im using php and I have a col named IP to store IP address's and i want to check this list to make sure the IP isnt in the table before i get php to add a new row of data. whats the best way to go about this ?
December 3rd, 2000, 09:44 PM
Create a unique index on IP should work
create unique index indexname on table(ip);
December 3rd, 2000, 11:52 PM
That's probably the best way. You can also do a search like
select * from table where ip = $ipToBeInserted;
and check the number of rows returned before inserting the row with new IP address.
You should probably do both.