RE: [PHP] Couple of questions form a PHP newbie
[snip] First question: I'm creating a custom content manager for a small site. It will basically be used to store short articles (several paragraphs each). Now my question is, is storing these to a text file going to work or am I going to have problems later on when the file gets to be a reasonable size. I ask this, because the only way I can seem to work with the text file is to read the entire file in and alter it that way. Are there any ways to edit or remove one line of a text file without having to read the entire file first? Would I be better off using a database instead of a text file (keep in mind that I know nothing about databases)? [/snip] Go to http://www.evolt.org and search for the ABC's of CMS articles. It is a good basic set for setting up a simple CMS using PHP and a database (in this case MySQL) HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Couple of questions form a PHP newbie
1. Text file or DB My answer - Learn how to use a database, it will make things much easier 2. Checkbox Try this: input type=checkbox name=sports[] value=Baseball input type=checkbox name=sports[] value=Basketball input type=checkbox name=sports[] value=Football input type=checkbox name=sports[] value=Handballball then after submission, you could do the dump, or foreach ($_POST[sports] as $val) echo $val; On Fri, 2003-07-11 at 20:10, Jason Giangrande wrote: First question: I'm creating a custom content manager for a small site. It will basically be used to store short articles (several paragraphs each). Now my question is, is storing these to a text file going to work or am I going to have problems later on when the file gets to be a reasonable size. I ask this, because the only way I can seem to work with the text file is to read the entire file in and alter it that way. Are there any ways to edit or remove one line of a text file without having to read the entire file first? Would I be better off using a database instead of a text file (keep in mind that I know nothing about databases)? Question two: I've read in several books that html checkbox forms can pass multiple values to the server when more than one check box is selected if they have the same name. However, when I var_dump the $_POST variable that should contain them I only get one value. Anyone have any ideas why? Regards, Jason Giangrande -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Couple of questions form a PHP newbie
Thanks for your help guys. The checkboxes thing is working great. Michael, regarding using files instead of a database, in your opinion, eventually having a 10-20 MB text file isn't going to cause any server problems if more than a few people are accessing the site at a time? I'm not talking millions, or even thousands of users, more like a few hundred a day. If using files should not be a problem, I would much rather use that method in this particular project. Thanks again, Jason On Fri, 2003-07-11 at 21:27, Michael Smith wrote: Jason Giangrande wrote: First question: I'm creating a custom content manager for a small site. It will basically be used to store short articles (several paragraphs each). Now my question is, is storing these to a text file going to work or am I going to have problems later on when the file gets to be a reasonable size. I ask this, because the only way I can seem to work with the text file is to read the entire file in and alter it that way. Are there any ways to edit or remove one line of a text file without having to read the entire file first? Would I be better off using a database instead of a text file (keep in mind that I know nothing about databases)? Flat files are perfectly fine. If you include them with PHP there is almost no performance hit. However, you could use file() to put them in an array and then array_search to figure out which key and only use that ... Question two: I've read in several books that html checkbox forms can pass multiple values to the server when more than one check box is selected if they have the same name. However, when I var_dump the $_POST variable that should contain them I only get one value. Anyone have any ideas why? the name attribute for the checkboxes needs to be name=somevar[] to be put in an array. Regards, Jason Giangrande Cheers, -Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Couple of questions form a PHP newbie
If that's the case I recommend using multiple files instead of one big. Just come up with some structure for them. I'd say 10-20MB text is pretty much. //Simon Jason Giangrande wrote: Thanks for your help guys. The checkboxes thing is working great. Michael, regarding using files instead of a database, in your opinion, eventually having a 10-20 MB text file isn't going to cause any server problems if more than a few people are accessing the site at a time? I'm not talking millions, or even thousands of users, more like a few hundred a day. If using files should not be a problem, I would much rather use that method in this particular project. Thanks again, Jason On Fri, 2003-07-11 at 21:27, Michael Smith wrote: Jason Giangrande wrote: First question: I'm creating a custom content manager for a small site. It will basically be used to store short articles (several paragraphs each). Now my question is, is storing these to a text file going to work or am I going to have problems later on when the file gets to be a reasonable size. I ask this, because the only way I can seem to work with the text file is to read the entire file in and alter it that way. Are there any ways to edit or remove one line of a text file without having to read the entire file first? Would I be better off using a database instead of a text file (keep in mind that I know nothing about databases)? Flat files are perfectly fine. If you include them with PHP there is almost no performance hit. However, you could use file() to put them in an array and then array_search to figure out which key and only use that ... Question two: I've read in several books that html checkbox forms can pass multiple values to the server when more than one check box is selected if they have the same name. However, when I var_dump the $_POST variable that should contain them I only get one value. Anyone have any ideas why? the name attribute for the checkboxes needs to be name=somevar[] to be put in an array. Regards, Jason Giangrande Cheers, -Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php