Jump to content

requinix

Administrators
  • Posts

    15,266
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. 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.
  2. 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.
  3. 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.
  4. 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".
  5. That would be trying to get the value of a property, such as $variable = $object->property;or $variable = $object->property->another_property;
  6. I didn't put the variables in this time but otherwise it's correct. $valid = ((ip2long($mask) | ip2long($address)) == ip2long($mask));
  7. 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.
  8. 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?
  9. 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
  10. What was the source $menu?
  11. 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?
  12. Yup. So is this still a question about how to do the check using PHP code? (What about the code I posted?) Or something else?
  13. This is definitely not a job for a regular expression. Is there any particular reason you want to use one? Because the normal answer is $valid = ((ip2long($ipaddress) & ip2long($netmask)) == ip2long($ipaddress));
  14. Where are you sending the email? Where are you loading the email template? Where is the email template located?
  15. So you're concerned that someone can mess with your URLs and put all sorts of bad stuff into the "id" value? Honestly, I think it's better to treat invalid values (like "--35") as invalid values, not try to somehow force them to be valid. Take the same action you would as if someone entered "id=foo" or "id=" or removed the id entirely.
  16. If that "Cannot modify header information" error message was referring to the setcookie() line then that's your problem: you can't call it after there has been any output. Rearrange your logic so that you set the cookie before beginning output. Oh, and your code says "clicked_twice" in some places and "used_twice" in others.
  17. Why did you remove the slashes from the JSON string?
  18. After you change the function to be preg_replace_callback, you also have to change the second argument to be a function and not a mere string. The simplest way is to use an anonymous function like function($matches) { // ... } $matches will be an array just like how preg_match() works, what with [0] being the full string and [1] being a captured group. Inside this function you call constant() and return whatever you want the replacement to be. Give that a shot. If you still have problems, post the code you tried.
  19. That means your query failed (the boolean is false). What does mysqli_error say? How can you be sure that $project_id has a value?
  20. Yup, that would work too. If the BetaKey isn't unique (and isn't supposed to be) then you should add a LIMIT 1 to the query so that it stops searching for matching rows after it finds the first one.
  21. mysqli_query will return a resource representing a resultset which you can use to access the data returned from the query. It does not return actual values. You have to use one of the assorted fetch functions to get those.
  22. I just noticed some mistakes in the code you posted that would (should) have caused your script to crash. Please code your complete code without any modifications.
  23. Apache is probably doing it (if not your browser). The exact behavior isn't as important as the fact that it is being handled without causing problems, even if that means by Apache and not the PHP script.
  24. Exactly what does console.log(data);show?
  25. Please use code tags instead of copying code from your editor and putting it directly into your post, like by using the button. It's much easier for us to read that way than to deal with whatever formatting you might have set up. I've done it for you this time, please remember to do it yourself next time. Now, the title says something about you having trouble? If you have a specific problem then it'd be great if you described what that problem is, rather than ask us to just look around for what it might be. For example, are you not sure how to make your search form do an actual search? What have you tried and how did it not work?
×
×
  • 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.