Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by etrader

  1. I am thinking of running foreach for the first array; then bringing the value of second array by $array2. But I hope to find a more standard method for this.
  2. I have two arrays as $array1=array("word1","word2","word3"); $array2=array("term1","term2","term3"); How can I have a foreach loop to echo "word1-term1", "word2-term2", .... I mean having echo "$array1[0]-$array2[0]"; but in a foreach loop
  3. No, I'm not on a shared server; but since this system uses very low amount of resources, I host many domains on the same server. I am thinking of shifting from ex3 to ex4; but I prefer to do so on a fresh server (maybe later). SQLite seems to be an excellent choice, but I was unable to find some statistics comparing its speed with other systems. I just worry about RAM usage for concurrent visitors as SQLite does not have server (of course, my knowledge is very little about this).
  4. Kira, I did not get how mysql uses lesser RAM comparing with file-based system. xyph, Categorizing files in sub-folders is easy, and beneficial for the OS; but still I think it's a problem as the number of inodes is still limited.
  5. I have a very simple system (few files) having simple articles (only title and a paragraph description) stored in single text files. I catch the data by $data=file('article1.txt'); $title=$data[0]; $description=$data[1]; This simple system works perfectly, but the problem appears when increasing the number of files (e.g. more than 10,000 articles). This is a problem connected with the OS behavior for handling huge number of files. My first question: Is there theoretically a faster system (e.g. database-based) for retrieving data, comparing with retrieving from plain text file? Second question: what can be an alternative for this very simple system (no search query or additional field)? 1. XML: It has the same problem if storing in different files. 2. Mysql: It is very advanced for this system. 3. SQLite:I am thinking of this, but it still have advanced structure of SQL. 4. DB Berkeley: I am not familiar with Oracle at all, and I need to install something new on my server. Is it really worth of trying? 5. Anything else? In general, I just need fast reading the data. I have no idea how much the speed of these systems are different to determine which is worth of consideration. Thanks for sharing your idea.
  6. How to write an IF condition for a specific time of day? e.g. between 18 and 18:30. To do something if the current time is between 18 and 18:30.
  7. It should be something like agent and getting information about visitors. When my script is accessed through an iframe (here facebook) there should be a difference with the case that the page is directly accessed. I think in the iframe case, facebook is accessing my page, and I should be able to detect facebook as a something like agent.
  8. Is it possible to have a cron job merely by php ? not by OS (like linux cron). I mean having a php code to repeat a process on with a timer (e.g. every 5min).
  9. I hoped to have something like $_SERVER to get the parent of iframe.
  10. When displaying a webpage within iframe of facebook fan page, how I can detect that my page is viewed within the facebook iframe? I want to have a if else statement to change something within the page if it is viewed through facebook fanpage (not by direct visit).
  11. Thanks for useful information. I learned a lot.
  12. As a matter of fact, the fame of SQL-based databases kept me away of noSQL. I was thinking of SQLite, but I have no idea how much lighter is MongoDB (comparing to mysql).
  13. Yes, I use append method to add new data as a new line. The problem is that when I read the file to get the last line, php walks across the entire file. Since this repeats regularly, it is necessary to avoid heavy task. I already use memcache (on nginx). Another way is to use mysql database. But the problem is that we regularly read and write data. Indexing mysql is good for the first one and bad for the latter.
  14. I want to save live data into file. My script fetch the data (one by one) and save it into file by amend method. The live data is not regular and every time it must be checked if the value has been updated or it is still the last value. One way to do so is to read the last line of the file and compare it with the fetched value. But in this case, I need to read the file for every check. Is there a way to remember the last value and compare it with the coming value? to write only new value into the file.
  15. Where is the best to store the list of categories and menu? Obviously it is better to reduce mysql queries. From a plain list in file, we can create desirable list (menu) from an array. This is quite faster (though SELECT from an indexed table is fast too; but I do know if it is as fast as reading from a php file). Any idea how to code this to create the menu faster ?
  16. Thanks PaulRyan, I want to include everything that is really needed. If I include 10 files (instead of one), this is because of the fact that another page may onlye need file2 and file7 to be included. This is the reason that I asked this question.
  17. We regularly use 'include file' to include general codes. But does it really identical to writing the code in the current php file? I mean does it take time to read an external file (comparing to the case that the code are simple writing in the processing file?). I am asking this question to know if there is a time difference between a single php file or include 20 external files (the same php code, just put on other files)?
  18. Good point Thanks for clarifying the issue!
  19. To me it is logical to store config data such as site name, meta, etc in a php file rather than storing ina table in mysql database. This will reduce the number of calls to the mysql database, as these are key parameters and needed in every page. But, a well-developed CMS like Wordpress uses a mysql table to store such basic data. What is your idea? Ain't it better to reduce mysql loads?
  20. I have a tag column in the table of posts. I store tags as "tag1,tag2,tag3,...". When displaying tags in the post, I explode to have an array. Everything is OK, but I cannot create a tags cloud; as I need to have the occurrence of each tag to increase the font. What is a practical trick to create tag clouds? I think the common method is to build a table for post tags and store each single tag in a separate cell. But I hope to keep my database tidy.
  21. Nice point! This is exactly what I meant. Captcha is a must, as human spam is also a serious problem. However, I think captcha hinders submitting the form; but when someone directly accesses the php file, no captcha is there to hinder him. Right?
  22. I mean an automatic system. For submitting a form, it is needed to be filled. But a spammer just needs to run a simple script to visit file.php?q=word1, file.php?q=word2, .... file.php?q=word10000,
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.