Karir Posted December 20, 2010 Share Posted December 20, 2010 Hey! I am making a comment system for my blog I'm making. The way I want it, is that when a comment is posted, it grabs the id of the post it's referring to, then creates a file called comment(POST ID HERE).txt.. I have that down, however I cannot for the life of me figure out how I can make it an increment, so it can make no more than 500, but everytime a comment is posted it will keep making the files go up like: comment1.txt comment2.txt comment3.txt Etc... Thanks very much, happy holidays! Link to comment https://forums.phpfreaks.com/topic/222180-create-file-increment/ Share on other sites More sharing options...
shlumph Posted December 20, 2010 Share Posted December 20, 2010 The way I want it, is that when a comment is posted, it grabs the id of the post it's referring to, then creates a file called comment(POST ID HERE).txt.. That means that a post will only be able to have one comment. Is that really what you want? however I cannot for the life of me figure out how I can make it an increment, so it can make no more than 500 With the way you're doing things, you're going to have to keep a designated file with a number in it, and increment it when a comment is posted. Or iterate the folder and count how many comment files there are. Why not just use MySQL for everything? You could have a posts table and a comments table. And have it be a one to many relationship. Link to comment https://forums.phpfreaks.com/topic/222180-create-file-increment/#findComment-1149413 Share on other sites More sharing options...
Karir Posted December 20, 2010 Author Share Posted December 20, 2010 Could point! I'll give it a go, thanks! Link to comment https://forums.phpfreaks.com/topic/222180-create-file-increment/#findComment-1149417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.