Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. That means that something you thought is an object actually isn't one. Try checking each one individually until you find the culprit. You can use var_dump(), and/or is_object(). Put your checks on the line before the line with the error. You'll need to check $this->incident, then $this->incident->startDateTime, and so on.
  2. If you are using mysql, use mysql_real_escape_string(). For html injection, use htmlspecialchars(). The wheel is there already, no need to re-invent
  3. $sep = ''; $sql = ' ( '; foreach ($array as $item) { $sql .= $sep . $item; } $sql .= ' ) '; I use this method quite often. Then you can use "WHERE MONTH IN $sql" If your months are string then you will need to escape and quote them.
  4. Do you mean that $english is not appearing in the second text area? Does it echo where you have "echo $english" ?
  5. OTOH, it is page view times that are the bottom line. A loop won't take into account parsing time, which for 50 classes may be quite significant. The loop is great for optimizing that particular code, but if that code accounts for only a small portion of total execution time then you haven't achieved much. Recently I halved the cpu usage of one of my scripts by culling dead code that was being parsed but not used. That's a 50% improvement just from reducing parsing time. Admittedly this script is quite light on processing, but still.. If parsing time is significant, you may see benefits by loading only those classes necessary for your code path. That can be messy to work out though..
  6. btherl

    PHP 101

    What do you see when you view the source of page C?
  7. Search engines do not know if you use include() or not, for the reason you mentioned (it's all done server side). All they know is the url, the headers and the final page text. They don't even know if you're using php or asp or whatever, unless you name the script "index.php", in which case they can make an educated guess.
  8. Have you tried mysqli_free_result() ?
  9. That code doesn't produce errors here. Can you post your entire script please?
  10. Aha.. well try installing the live http headers extension, so you can monitor what is sent. http://livehttpheaders.mozdev.org/ Then at least you can be sure the cookie is being sent.. after that, it's a question of why you can't find it in php..
  11. '00:04:50.05" is valid syntax for time, but not '4:50.05'. Here is the full list of valid inputs: http://www.postgresql.org/docs/8.1/interactive/datatype-datetime.html#DATATYPE-DATETIME-TIME-TABLE
  12. Are you looking for this: SELECT * FROM menuitem JOIN menuprice ON (menuitem.id = menuprice.menu_id) That will give you duplicate rows for an item when there are different sizes, so you can no longer assume each item is listed once, which you probably could when you queried from menuitem only.
  13. Your image link doesn't work for me
  14. Have you verified that your browser is sending the cookie? Storing it doesn't necessarily mean it'll send it.. though I'm not sure why it wouldn't. You might want to try with firefox if you are using IE, and see if it behaves differently.
  15. I think you want && (and) instead of || (or) "If referer is not myself and referer is not null, then increase count" instead of "If referer is not myself OR referer is not null, the increase count" The second one is always true.. I would write it like this: if ($_SERVER['HTTP_REFERER'] !== "http://www.leagueofvillains.co.uk/?area=$area&id=$id" && !empty($_SERVER['HTTP_REFERER']))
  16. I would recommend having a static database for queries that is rebuilt regularly (daily or weekly). That should be sufficient for your particular application. Then your query database can be optimized for searching, and your query logging database can be optimized for fast inserts. 5000+ simultaneous users is a lot btw If you have a high volume of inserts/updates, one solution is to do inserts only, then aggregate the data later. That allows you to write the data sequentially (assumign nothing else is using that disk), which is a big win over having to do random access to check if a particular query exists already.
  17. The first error will probably be fixed if you initialize $y to an array (the line you commented out). It would also be less confusing if you used a different name for the count, instead of re-using $y. And $y is not a good choice of variable name It doesn't say anything about what it holds. Also, these are the two options for ($i = 0; $i < count($x) ; $i++) for ($i = 0; $i <= count($x) - 1 ; $i++) By mixing those two up (using both "<" and "- 1"), you are missing the last element of the array. Unless you intentionally do not want the last element to be processed. For the second error, $array_count_values is not an array. This is probably caused by your first error.
  18. You might want to try this suggestion: http://sg.php.net/manual/en/function.mail.php#27997 It refers to this function http://sg.php.net/manual/en/function.mb-send-mail.php And provides an alternative if the above is not available. The mb_* functions were written to support japanese text, so you should find them useful.
  19. aleph in hebrew encoded in utf-8 will never equal some other character encoded in utf8. But be aware that characters that have the same meaning may have different utf-8 encodings for various reasons. As long as your users enter their username the same way every time you will have no problem. Take a look here for gory details: http://www.unicode.org/reports/tr15/#Introduction So yes, you will not get false positives (matching a name that it shouldn't match), but it's possible to get false negatives (not matching a name that should match). A good example is the german "ss", "ae", "ue", "oe" which are identical in meaning to ß, ä, ö, ü, but will be encoded differently. This does mean that if one person signs up as "Günther" and another as "Guenther", they will be considered as different. Which is probably ok, as they are visually different, although they represent the same name.
  20. Aiyah, that's not going to be easy. What version of mysql did your old host use? If I was trying to restore that I would install the same version of mysql and copy the database files in, then start it up and pray.. it's not the sort of thing you can do via cpanel unfortunately. But, if you can get it running ANYWHERE (even your own home pc), then you can dump your database into text files that can be imported into your new database with ease. I hope your new host is relaible.. I'm paying US$20 per month for yahoo hosting. It's not cheap, but I know they won't disappear overnight. That continuity is worth the premium.
  21. btherl

    Emailing

    I haven't done mass emailing either But I have experience in queueing resource intensive jobs for background processing. In my experience, the best thing to do is to try it out. Your mail system should also be able to queue emails, so I doubt it will take long, unless you are actually attempting to send the emails directly to port 25, rather than letting your server's mail system handle them.
  22. I get your point, 448191. I agree that optimized OO objects will work well together. I think I'm thinking about decoupling rather than OO itself. Decoupling whether in traditional programming or in OO. It's a nice idea, but so often it leaves me thinking "If only that library/object knew what I wanted to do, then it would have provided the right interface". In those cases I choose development time over efficiency, as that's what business needs dictate. Hardware is cheaper than programmers Things remain decoupled and efficiency is lost, and we compensate with bigger and faster machines.
  23. Sorry, I misread. Nightslyr did indeed say "a programming problem". To answer your question, have you seen the processor and memory requirements of Windows lately? OO has improved its reliability greatly, but it also increased its requirements for cpu power and memory. Most people don't notice because computers have gotten so much bigger and faster. But here I am with 1GB of memory, and wishing I had more. For a simple programming example, is it faster to have your query object fetch the data and then pass that data to the display object to display, or to simply display it directly? The first is more flexible, the second is faster and more memory efficient.
  24. You forgot the negative aspects.. which I feel I am compelled to mention, since you claimed that "OOP is the answer" - Decoupling reduces opportunities for optimization. As a result, OO code is always slower and takes more memory than traditional code. It's a tradeoff. Where speed and memory are at a premium, OO code is the wrong choice. Where speed and memory grow on trees but reliability and speed of development are critical, OO is the right choice. - OO code is slower to develop initially, due to the overhead of the OO framework. The tradeoff here is that OO code is easier to re-use later. - OO taken to excess or applied inappropriately will lead to bad code. This is true of any other programming technique of course
×
×
  • 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.