-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Pass the PHP vaiable to js file using ajax script
requinix replied to Senthilkumar's topic in PHP Coding Help
That response doesn't look like the data you need. In the earlier code, you had three arrays: one of Region, one of McTotal, and one of McAssigned. Now you have one single array with all of the Branch (not Region?), McTotal, and McAssigned values. If you make your PHP return the three arrays separately from each other (such as in an object) then your Javascript can take the three arrays and use them with the graph. -
Pass the PHP vaiable to js file using ajax script
requinix replied to Senthilkumar's topic in PHP Coding Help
What part are you having a problem with? Is it the Javascript? Can you change your Javascript so that the graph can update when one of those variables changes? Make a function to do this, make its arguments be those three values, then call that function when the page loads. Is it the PHP? Can you change the code so that it filters in the way you want, getting whatever values it needs to do so from $_POST? -
You're throwing a lot of CSS at this problem. If you have a problem, adding more CSS rarely ever makes things any better. Rethink how your different blocks of content are arranged. If you want the border to span the width of the input as well as the button, don't put the border on the container. If you want the button to sit next to the input, don't use absolute positioning. If you want a gap between the input and the button, don't add padding to the inside of the input. Learn about margins vs. padding, about inline-block, and if you want bonus points, about flexbox.
-
Rule set and debugger for PHP in Visual Studio
requinix replied to TeamPHP's topic in PHP Installation and Configuration
I would first check the VS PHP extension to see what support it has; probably not PHP_CodeSniffer, but quite possibly Xdebug. If not then there's a good chance you're out of luck - because nobody uses Visual Studio for PHP. And, frankly, you should take that as a hint, and go for a PHP IDE (like PhpStorm) or switch to VS Code (at least for this). Don't get me wrong, I like Visual Studio. I think it's a great platform. But software development is about using the right tool for the job. -
Your command will set the "Content Block" value to a string which happens to contain JSON data. If you want that string value to be interpreted into a JSON value then try CAST-ing it.
-
Rule set and debugger for PHP in Visual Studio
requinix replied to TeamPHP's topic in PHP Installation and Configuration
Visual Studio or VS Code? Anything you haven't been able to figure out with some searching on your own? Myself, I'm seeing a number of results on how to set both of those IDEs up for PHP development... -
Your .swiper-slide is being overridden by the "swiper-bundle" rules. Don't fight the framework. If the swiper wants to have width:100% then put it inside a fixed-width container.
-
1. If you use /s for regex delimiters (at the beginning and end) then any /s you want inside the regex have to be escaped. Look at what your original had. 2. What's the rest of the code?
-
Why would you use Javascript for this? It's okay to have the regex be multiple patterns. You don't, not necessarily, have to use a single capture group to get the one value you care about. youtube.com/shorts/(\w+)|youtube.com/watch\?v=(\w+)|youtu.be/whatever else Only one of $1 or $2 (or what you put in the "whatever else") will ever have a value. And do remember that "." matches anything, so "youtubexcom/short/blah" will match the above too.
-
is my curl_multi_exec "ALTERNATOR" script realllllly working?
requinix replied to ChenXiu's topic in PHP Coding Help
Ha ha, what? That's their solution? To make you get another API key so you can query for 2x the SKUs? What happens when you need 9? 10? 20? Is the API so expensive for them to run that they can, really, only handle 3 at a time? And then, why not simply run multiple requests? You already have that there - just use the same key. Is there also time-based throttling on what you can do? This is so weird. That aside, work it like this: Using one API key, get yourself a loop that can do all the SKUs. So basically what you have there (if it didn't have the key stuff). That's the basic functionality you need here, and you can think of the "swap between API keys" as a small layer to be added on top of the functionality. Then, set up an array of keys - because distinct variables makes this awkward to work with, and even more awkward to maintain if/when you discover that you need to add a third key. To pick the key to use, think of it in the general sense of "I have multiple keys and I want to cycle through them". Because a mindset of a fixed number of keys (especially 2) will get you stuck into a narrow line of thinking (like needing to alternate between them). "Cycling" works simply and doesn't need to be adjusted based on the number of keys: cycling is picking key 1, then key 2, then key 3... then when you're on the last key, you go back to the beginning. Cycling requires a counter, of course, but tou can get one from the foreach/array_chunk and that will count up automatically without you having to increment it yourself. Then take your counter, add modulus based on the number of keys, grab that key, and stick it into your API. const MAX_SKUS_PER_REQUEST = 3; $keys = ["one", "two", "three", ...]; foreach (array_chunk($sku_numbers, MAX_SKUS_PER_REQUEST) as $i => $chunk) { $key = $keys[$i % count($keys)]; ... } -
Split. What are you talking about, what is your code, and what is the problem with it?
-
If you want to model the concept of navigation menus then you should probably use a Model. If you want to write code to determine how navigation menus are viewed then you should probably put the code in a view. Consider that you can create an anonymous, recursive function in a view file, then call it. If you're not sure then your first step is to make the functionality happen at all. You can figure things out along the way - it's not like you have to get everything right on your first try. And when you have it working, then you can think about how to improve it.
-
ASCII art just has a certain feel to it that mere HTML tables don't. That said, they are a bitch to type out.
-
How about this? It's the table button next to the bullet and numbered list buttons.
-
finfo doesn't care about the file's name - only its contents. And it seems that your 2010 file reads a little different from the 2009 version, enough so that finfo can't tell what's in the file. The unfortunate truth about MIME detection is that it doesn't work very reliably in many cases. Generally, you're better off examining the extension and then trying (when possible) to verify that the file is valid for that extension. In the case of PDFs that's actually kinda hard to do. Is there a problem with just trusting that your *.pdf files are PDF files? What other kinds of files do you need to handle?
-
In variables.php, use constants instead of variables. Because constants can be used as default values while variables cannot.
-
Is there any chance whatsoever that you can change the nature of that column? As you've found out, storing the recurrence information with a number like that makes it very hard to work with, and there are far simpler and easier schemes you could make use of instead...
-
What kind of "confirmation" are you trying to get? A popup for the user that they want to submit? A confirmation checkbox included with the form? Something to present to the user after they've submitted the form?
-
Yeah no, there would definitely be no such thing. That's way too specific for PHP.
-
lol. Databases are built to handle far more than that. Even with image blobs. If you don't want them visible then you could still store them as files - just outside the web root. But it does mean that particular advantage doesn't matter to you mostly.
-
CSV is text data. JPG is image data. It does not make sense to convert one to the other. ...unless you have some kind of specific knowledge about this process. Specific knowledge that nobody else probably has. So if your question is "is there a script out there made by someone to happens to share my specific knowledge" then the answer is no. Describe, with details, what it is you want to do.
-
"output started at index.html:1" You cannot use headers if there has been any output. The message tells you exactly where, and looking at that line, I don't know why you have it in the first place...
-
For simple applications, storing the file on a server is typically the easiest approach: file gets uploaded, you stick it somewhere that's accessible by the web server, and you can use a direct URL straight to the image. Breaks down when you have multiple servers. Doesn't support cases where you don't want just anybody on the internet to be able to see the image (though in this case you probably do want that). And backing up those images can be a pain in the ass. The alternative is storing the image in your database. Has overhead, like having to know the image file type and needing to provide some sort of script that can render the image, but the benefits may be worth it.
-
You're asking for advice about a specific implementation of something that I, and presumably many others here, have no idea about. What "function"? What "data set"? What "fields"? What is it that you're worried about "duplicating"? Then you say something about needing multiple database connections, which makes me worry...
-
Go to the page in question, do a View Source in your browser, and find the HTML for your form. What is the value of the form's action?