Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

Everything posted by btherl

  1. Try adding this line: $cat_id = $_GET['cat_id']; # <-- Add this $get_vars = "cat_id=".$cat_id; make_next_previous_with_number( $from, $SQL, $this_file_name, $get_vars ,$display_nr); No guarantees but if it works, it'll be a simple solution and you won't need to get into the code in detail.
  2. Ok, what I can tell from that code is that $vars does not have the expected value. $vars is an argument to make_next_previous_with_number(), so the problem lies somewhere else, in the code that calls this function. So you will need to track $vars back through the code to find where it is being set, and why it doesn't have the value you expect.
  3. Holder, are you using the same function, make_next_previous_with_number()?
  4. What output do you get? Are there any errors reported? Make sure you check for errors after every call that could fail.
  5. I notice you're not using sercfg in the last code you posted, is there a reason for that? You could try leaving all the pipes open. Plink might be unhappy to have stdin closed. But I think the most important thing is to make sure you are using non-blocking I/O. This function might work: http://php.net/manual/en/function.stream-set-blocking.php
  6. It sounds like your code already has a way to identify which checkbox is which, but it isn't working properly. You really need to post that part of the code.
  7. Hi Giuliano, What about using proc_open() instead? There is an example in the php documentation for how to use it: http://php.net/manual/en/function.proc-open.php The problem with exec() is it will wait for plink to terminate before returning the output. And plink never terminates. But proc_open() will let you run plink at the same time as php is running. In your test above you still get the output in the log file because plink is running and writing to the log, even though php is suspended waiting for plink to finish.
  8. Maybe you can call putty first to get the port into the correct state. Perhaps with plink.exe. Or you could put your entire connection through plink.exe using proc_open(). Maybe it'll work
  9. Well, yes and no. It does not specifically mean "unknown". It means "unknown" or "inapplicable" information - i.e. it does not exist. If I do a DB query on the parents table and JOIN it to the children table, a user with no children will have null values. If I do a COUNT() using GROUP BY for those children I get 0. If the result of the count was unknown I would get a null count. It can mean either or - which is why Codd had proposed using two different NULLs to differentiate the two. Codd's rules: Thankyou, that's quite interesting.. I tried it and it works just like you said. I never count columns, only count(*), so I hadn't noticed.
  10. Detecting encoding is tricky business, and mb_detect_encoding() probably won't help. The problem is that EVERY document is valid in the ISO 8859 and windows code pages, they just end up with different characters. Not all documents are valid UTF8 though, so you can sometimes rule UTF8 out. Trying to decode the document as UTF8 is a good start, because if that fails you know it's not UTF8, it's something else. Another good start is to check if there is nothing other than plain english characters - if that's all there is you don't need to do anything. If you can, do what ChristianF is suggesting and make sure you know the encoding and don't need to detect it. Also if you know what languages you are dealing with it helps. Eg if you are just dealing with chinese or japanese, there are specific encodings they usually use and you can distinguish them more easily. And many languages have a standard code page that everyone uses.
  11. I'll continue splitting hairs . In SQL null was intended to represent "unknown" specifically. It's different from what it means in a programming language. That's why it has these semantics: x > null : false (x might be smaller..) x < null : false (x might be larger..) x = null : false (x might not be equal) x != null : false (x might be equal) It's the last one that is surprising - if null meant "no value", you would expect everything to be not equal to null. But because it means "unknown", and we don't know if x is not equal to an unknown value, the comparison is false. It's different in a programming language, where null means "no value" and x != null is true because x has a value and null doesn't. In php you have to do x !== null to get these semantics, which is an unfortunate design choice IMHO. Strict comparison should be the default. Of course in practice most people use null for "no value" in sql anyway.. and we've all learnt to work around sql's assumption that null means unknown, like using the "is distinct from" operator - it's just like "!=" except it treats null as not equal to any known value.
  12. Comparing against null with its traditional meaning from SQL is asking "Is this variable unknown?". It's a sensible question to ask, and routine when doing left joins. Being unknown is information, and sometimes we need to know the difference between "unknown" and "known", or "unknown" and "doesn't exist". If we carry the same meaning over to php, it still makes sense to compare against null when asking if a variable has an unknown value. It's true that it's often used to mean "undefined", like perl's "undef", but that's because of how PHP treats undefined variables. Programmers are just following PHP when they do that.
  13. Ok that's fairly clear. What exactly is your question though?
  14. "approve" and "accept" only apply when saying a post is accurate. "thanks" only applies when a post is helpful to you. For that reason I like "kudos" and "like" better, as they can have either meaning. It just means "this is a good post". If a novice uses it it means "this is helpful", and if an expert uses it it means "this is accurate". I am Btherl for president, and I approve this post.
  15. Some people are passionate about nulls I've got a simple rule - use === whenever possible, because it keeps things simple. It's the right operator for nulls and string comparisons. == is suitable for comparing numbers only, when you want php to do the necessary conversions between strings, floats and integers.
  16. Your email address must never be in the form - otherwise someone can hijack your form to send spam to other people, just by sending their email address in place of yours. The email address will be stored somewhere else (on the page that processes the form, as scootstah says) I can't help with the action unfortunately as I'm not familiar with Wordpress. But I would assume you don't need to change it from whatever it was before you started customizing..
  17. I'm a little unclear on the terminology you're using, but I think you want something like this: <?php $sql="SELECT * FROM info WHERE info=\"".$info."\" AND page LIKE \"info-body\";"; require("connect.php"); for ($i=0;$i<mysql_num_rows($con);$i++) { $setter=mysql_fetch_array($erg); if ($setter['info']{0} != '$') { echo("\n".$setter['info']."\n"); } } ?> I'm assing that $setter['info'] is the value you want to test to see if it starts with '$'. If it's not, just change it on the line starting with "if" By the way, I'm confused as to where $con and $erg come from, and why they don't match - usually you would call mysql_num_rows() and mysql_fetch_array() on the same variable. It's also not the best code structure to have the query performed inside connect.php, which appears to be what is happening. If you can post the definition of your table, and maybe some sample data from it, that would help a lot.
  18. I think if you did it where only the approval/like/thumbs-up count was shown but could toggle a hidden div with the voters it would be really tastefully implemented Exactly.. Facebook does it well. xyph, is what's shown in the following link what you want to avoid? In this particular case it's ok because the main post is so long, but in general it's a waste of space to list every single user: hxxp://www.wiihacks.com/recommended-faqs-guides-tutorials-only/96886-guide-softmod-any-wii.html
  19. Like!! xyph I don't think it takes away from any of the good points of the forum. If I have a comment I will still post it. If I don't have a comment but I only want to say I agree or disagree, then without a "like" feature I will just say nothing. If there is a "like" feature I will use it. So it doesn't take away from any of the discussion, it just adds a "how many people like this comment" dimension to each comment. And there will be screen space saved by eliminating "agree" posts. People who disagree will probably make a post about it anyway, unless what they want to say has been said by someone else already, in which case they can just disagree with the original post, agree with the reply, and not waste any more space.
  20. So is the situation that var_dump($i) shows the expected value but XDebug doesn't show it? I strongly suspect it's an issue with XDebug then. If var_dump() works then you are getting the correct value, and your script should be able to run as intended.
  21. Can you post the code which doesn't work? The code from the original post doesn't use $i $j or $k so you can't tell from the behaviour whether the assignments work or not.
  22. I copied and pasted your class definitions, added var_dump() and created an instance. The code is: <? final class HttpKeys { const EMPLOYEE_HTTP = 'employeeHttpKey'; const EMPLOYEE_LOG_OUT = 'employeeLogOutKey'; const EMPLOYEES_UPDATED = "employeesUpdated"; const LOCKS_UPDATED = "locksUpdated"; const MENU_ITEM_COUNTS_UPDATED = "menuItemCountsUpdated"; const MENU_ITEMS_UPDATED = "menuItemsUpdated"; const MODIFIERS_UPDATED = "modifiersUpdated"; const ORDERS_UPDATED = "ordersUpdated"; const PAYLOAD = "payload"; const PRODUCT_CATEGORIES_UPDATED = "productCategoriesUpdated"; const STATUS = "status"; const TERMINAL_HTTP = 'terminalHttpKey'; const TERMINAL_LOG_OUT = 'terminalLogOutKey'; const TERMINAL_REGISTRATION = 'terminalRegistrationKey'; const TIMESTAMP = "now"; } class ClientUpdates { function __construct() { //-- this does not work $i = HttpKeys::PRODUCT_CATEGORIES_UPDATED; var_dump($i); $this->getProductCategories(); } private function getProductCategories() { //-- this does not work $j = HttpKeys::PRODUCT_CATEGORIES_UPDATED; var_dump($j); } } $c = new ClientUpdates; ?> And the output is string(24) "productCategoriesUpdated" string(24) "productCategoriesUpdated" So it is working here. My php version is PHP 5.3.3-7+squeeze13 with Suhosin-Patch (cli) (built: Jun 10 2012 07:31:32)
  23. For this situation I typically use this combination: if(!ctype_digit($_POST['item_stock']) || !($_POST['item_stock'] > 0)) That's for situations where I want an integer greater than 0. The first check excludes anything other than positive integers, but still allows "" and "0". The second check excludes "" and "0". If you do this a lot you can make a function for it. If this is a text input then I would also use trim() first, because a lot of people add space into text inputs boxes.
  24. Or arsort() if you need to know the index of the 3 highest values, rather then the 3 highest values themselves.
  • 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.