I am making a voting system for my website, but the website has no registration so I wanted to make it so that people that have already voted can not vote again. I wanted to do this by storing all of the ip addresses into a database by concatenating them and making it so that if someone that has one of those ips tries to vote on the same post then it sends out an error message.
Thank you in advance.
For your question as is: I would do it slightly differently. I would create a table in my database called "votes" that acts like a sratch table. The fields I would have would be simply: IP and PostID
When your script runs it can take the IP and PostId, search for both values using a WHERE IP = theirIP AND PostID = the_post_ID. If a match is found then show the error.
But, as has been commented, what happens when multiple people using the same Internet connection complete your voting?
Realistically, the method you are employing is flawed because of above. This is where a simple user registration should be used. This will guarantee your system works as desired.