Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Presumably both of them do so to match the original mysql, whose fetch_array returned the combined form. And I'm going to guess it did out of some sense of "maximum usefulness, minimum effort": call the thing that returns an array and you can use it however you want. $_REQUEST will have come out of that same sort of mentality too, back when PHP was treated more like a templating system than a programming language.
  2. You don't have to if you don't want to, but it is the package management tool for PHP. And it's not like you have to install any actual software - Composer is, itself, also PHP code that you can simply run.
  3. Those are just PHP libraries. PHP code. They'll work just as well as your own code does.
  4. 1. CAPTCHA 2. CAPTCHA 3. Use a mailing library like PhpMailer or SwiftMailer instead of doing it yourself with mail() - not least because they will construct proper emails that are less likely to hit your spam filters 4. CAPTCHA
  5. Parentheses are for grouping. You use them when you want to deal with things as a group instead of each one individually. "Alice is driving to work, and Bob is driving to work, and Cindy is driving to work": the three of them are each taking their own cars to work and contributing to local traffic problems. "(Alice and Bob and Cindy) are driving to work": the three of them are carpooling like responsible human beings. Having parentheses for the sake of having parentheses is wasteful but not inherently wrong. But when you throw other things into a regex, like + or *, and to apply them to the parenthesized group, then you change what the regex does. "(Alice and Bob and Cindy)+ are driving to work": there are some number of people, every one of them named Alice or Bob or Cindy, and they are all driving to work together in one comically-oversized minivan. "(Alice and Bob and Cindy)* are driving to work": maybe there are three people driving to work, or maybe there are more than three people, or maybe there aren't any people at all because it's the weekend and they don't work on the weekend. Try this.
  6. No. When testing software, your goal should be to break it. To make it do something you don't want, or to not do something you do want. Simply testing some examples of what you want and what you don't isn't enough. Since I have other things to do today, $pattern = "/^[A-Z][a-zA-Z '&-]{1,48}[A-Za-z]$/"; Try both your solution and my solution against the string AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyz
  7. Then you didn't test it very well. Nevermind your current problem. Go back to what you had before and make one simple change to it. That's the puzzle for you to solve: there is a single change - replacing one thing with another - that will make your original regex do what you need to do.
  8. You've tested that with things you want to allow, I assume. Did you test it with things that you didn't want to allow?
  9. Think about it a little more: 1. The name must start with an uppercase letter. You already have that. It will account for 1 character. 2. The name must end with a letter. You already have that. It will account for 1 character. 3. If you require 3-50 characters total then that means the part in the middle must be between ___ and ___ characters long.
  10. MDN, mostly. MSDN has some stuff too.
  11. I'm suspicious of your action.js. Please post the exact contents of that file. And you're sure there are no errors in your browser's console at all? So you load the page, open the console, and it says nothing?
  12. "Uncaught TypeError"? What is the uncaught TypeError it speaks of? There should be more to the message than just that...
  13. 1. IDs are unique. You cannot have more than one #from or #to on your page. Find some other means of identifying which inputs you want datepickers on. 2a. If you create a bunch of elements and some of them need to be hooked up with some Javascript stuff, (and you can't apply the Javascript stuff globally,) then hook up those new elements with the Javascript. 2b. When applying the datepicker, all you need is some jQuery collection - you can do whatever it takes to get a collection of the elements you want. 2c. There are multiple easy ways to have jQuery return you a set of elements somewhere specific and not across the entire document.
  14. Using those handlers is frowned upon in modern Javascript. For one, because it's not actually a binding process: you're literally assigning a function to that property, which means you can't assign a second one to it as well.
  15. If you're having a problem with an error then it's typically very helpful to others if you mention what that error is.
  16. Understand that this is a completely different problem than the one you asked for. Specifically, this is a great example of the X/Y problem: asking about your solution of "how to restrict window/tab sessions in PHP" as a means of accomplishing "we want to run some performance testing using multiple independent Chrome windows". Chrome is capable of running an instance (of the version installed on the computer) using a specific profile directory. It takes a little more setup since you need to create multiple profile directories, but that can be done mostly automatically with appropriate automation. If you're searching the internet for answers then look in the direction of automated UI testing: that universally involves scripting a browser to perform actions, which is what you want to do.
  17. Not Chrome. All incognito windows share the same session data.
  18. PHP can't tell the difference between one tab/window or another. The only option is to restrict all browsing such that the user never even leaves the page at all: by rewriting your site from the ground-up into a single-page application ("SPA"), meaning you're going to set aside a lot of PHP and do the majority of work in Javascript with frameworks like React. And by the way, this is a bad idea.
  19. print_r() will display a boolean true as 1...
  20. Not sure how "I am using a database" means you can't use Google Maps? You can even use a custom "map" image, if you like the cartoonish style - people have done so with things like this GoT site.
  21. You need to have the code remember what the two colors are. The user picks one, but they have to pick another so you can't do a gradient yet (unless you have default colors), and the user picks the other. Each click of the button only tells you how to update a single color, which means you have to track what the other color is supposed to be yourself. But there is a fancy way of doing that: CSS variables. https://jsfiddle.net/jqrg7vcf/ The less mucking about with CSS rules you have to do, the better. Note that a gradient background of blue -> blue is the same as just a straight blue non-gradient background.
  22. VS Code and Netbeans can both be managed through apt, and PhpStorm is available as a snap and those naturally auto-update.
  23. If I change the max-width on the .trailMap, the markers reposition correctly for me. How are you trying to resize it? And instead of positioning elements over the image like that, consider using an older technique instead: the image map.
  24. Do you have any kind of PHP support at all? Autocomplete? Documentation? Popups? Been years since I used Eclipse... It wasn't like a regular text editor: you couldn't just open a file and have it work according to the language, you had to set up a PHP project to get PHP support. So unless that's changed, are you doing that? Honestly, though, Eclipse is a bit... dated, compared to what people use these days.
×
×
  • 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.