Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Is it the only in the document whose value is "YES"? Then //p[.="YES"]Which is, conveniently, an XPath "address" to the node.
  2. Find the node using whatever you want, then call getNodePath(). Or are you trying to violate causality by using the path to the node to get to the node in the first place?
  3. What is the code you have for the that does not work?
  4. Do not post sensitive things like API keys to a public forum. I've removed it for you this one time as a courtesy so be more careful in the future. 1. I don't know what XML you're looking at, but the one I'm looking at doesn't have things like location/city or current_observation. 2. You must do some work with $city before you stick it in the URL. Do some simple validation and then use rawurlencode() when putting it in the URL. 3. You are using a loop for the current_observation. If there is more than one then your $output will be messed up because you keep overwriting it each time through the loop. 4. json_encode() does not output anything. You have to echo the return value yourself. 5. $output[0] is just the time. Or the first character in the error message. 6. Outputting $output[0] will (likely) not be valid JSON. Use json_encode(), output the return value, and don't output anything else. 7. That HTML string is not valid JSON. Figure out another way to show an error message.
  5. So what changed since yesterday? Because if it worked yesterday and not today then something did change.
  6. It'll be easier to help you with the code you have than to come up with something from scratch. What's your code so far, and exactly what kind of problem(s) are you having with it?
  7. Compare the two: $output['data']['502438129'] $output['data'].$testThey don't look similar, right? You'd expect them to look similar, right? If $test has the value '502438129' then simply replacing the string with the variable leads you to $output['data'][$test]
  8. Right. I was thinking more of the exact output. And while I'm at it, can you use var_dump() instead?
  9. What does it show if you remove the if?
  10. Alright. So what is your question about error handling? What's not working? And can I assume you're aware of the syntax errors in your code? And a few other errors...
  11. Your character encoding settings are not consistent. Make sure that - Your HTML pages are using UTF-8 because they do not by default; use a and/or configure your server and PHP code to return the UTF-8 encoding - Your database has utf8 as the default encoding; a SHOW CREATE DATABASE will the encoding - Your table is using the utf8 encoding; a SHOW CREATE TABLE will show the encoding - Your table columns are using the utf8 encoding; if your table is but your columns are not then a SHOW CREATE TABLE will show it - Your database connection is using the utf8 encoding; for MySQL you have to pay attention to both the server and client settings Missing any one of those can cause the problem you're seeing.
  12. What is your question about error handling? What's not working? And when you answer, post your code too.
  13. Well, you need to decide which of those you want. The first is self-contained to your application, but someone has to go to it before they can see their "bookmarks" - typically called "favorites" instead, to avoid confusion. The second means the user has a link in their browser they can click from anywhere, but if a user has a lot of bookmarks then that could be awkward for them to deal with. Note that this isn't a technical question. It's about what your users need and want to be able to do.
  14. Before getting to your problem... which I haven't been able to decipher yet... What is a "bookmark application"?
  15. The offset is incorrect: $myoffset will be a page number like 1,2,3 when it needs to be a starting offset like 0,25,50. I suggest putting off building the query, or at least the LIMIT part of it, until after the pagination object is available - then you can use its calculations for the offset (in the offset() method). After you have the query, execute it and display the results however you want. Strictly speaking the pagination work is really just about getting the page number in the URL, getting links to navigate between pages, and adjusting the query's LIMIT accordingly. And you have that part.
  16. Makes sense: there isn't actually any code in there to execute the query (which is supposedly contained in the $mysql variable), nor to display the results. Does the tutorial add that code later? And what does it say about the query? Because what you have in $mysql is incorrect.
  17. It's very much a per-server thing, and you'll find that most servers only allow .php (and occasionally .php5) so that's the most reliable extension to use. However you can often add some configuration, even as just a regular user, that will allow it.
  18. The file is named "reviewparts.html" and that server isn't configured to execute .html files as PHP code. If you look at the source of the page you'll see the full PHP code - as if it weren't even executed at all. Try simply renaming it to "reviewparts.php".
  19. That would be trying to get the value of a property, such as $variable = $object->property;or $variable = $object->property->another_property;
  20. I didn't put the variables in this time but otherwise it's correct. $valid = ((ip2long($mask) | ip2long($address)) == ip2long($mask));
  21. Make sure you're connecting to the right server, otherwise you'll have to contact them to find out why the server is read-only.
  22. I was hoping for the full array, not just part of it... Are you sure $menu is starting off with the values you expect? That div07-div10 and mod001-whatever (mod010 I would guess) all have values?
  23. Okay, so you have a subnet mask and you want to check whether a given network address is valid for the mask? Pretty much everything to do with IP addresses is easier to do with straight numbers. Check that (ip2long(mask) | ip2long(address)) == ip2long(mask). - The mask has all network address bits set and all host address bits unset - Bitwise OR will only set bits - If the result differs then it must be because new bits were set, and those bits must have been in the host address portion, and those bits needed to remain unset to stay valid
  24. What was the source $menu?
  25. Let's establish some terminology: - 192.168.12.34 is your IP address - 255.255.255.0 is the netmask - 192.168.12.0 is the network prefix = IP address & netmask - 0.0.0.34 is the host part = IP address & ~netmask If you're trying to determine whether an IP address matches the network prefix then you'd want the code I posted. If you're trying to determine whether an IP address belongs within the network then you need to know the correct network prefix too. Now, what are you trying to get?
×
×
  • 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.