Jump to content

requinix

Administrators
  • Posts

    15,290
  • Joined

  • Last visited

  • Days Won

    436

Everything posted by requinix

  1. Look at the condition again. Are you using the right columns for everything?
  2. Why are you preloading two different URLs? That don't match what you're using for the IFRAME?
  3. 1. Look at the second JOIN. Does the condition have anything to do with the table it's trying to pull in? 2. You cannot compare anything to NULL. The result will always be NULL. That's how it works. If you want to know whether something is null then you should be using IS NULL.
  4. 1. The second JOIN looks just like the first one, has all the same conditions, plus it looks for dept_core and status_id. The whole point is to find "matching" (whatever that means to you) production_status that also meet your exclusion criteria. 2. Forget the WHERE NOT EXISTS. Get rid of it. Instead you need a WHERE to make sure that the second production_status, which you should give an alias, did not match - the easiest method for that being to test that a non-nullable column was null.
  5. Do your query like you would normally do if it didn't have that condition. I don't know if you want that JOIN to be LEFT or not. Then add another LEFT JOIN to production_status like you'll already have, except it has the additional conditions for the dept_code and status_id. So the join will attempt to find matching records in the table. Then add a WHERE so that you only include rows when the second JOIN didn't find anything.
  6. Are you trying to exclude rows from production_data that have any 13/3 rows in production_status? Or just not include the 13/3 rows in the results?
  7. Fails with what message? What "doesn't work" and exactly what does "breaks CSS" mean?
  8. Depending on your terminal, yes.
  9. You said you took the FL if statement out. You did not post that version. But it's not as important as posting the code that is calling this function.
  10. Post your modified function as well, as the code calling the function and any other code that could possibly be relevant to your problem.
  11. What about states other than Florida?
  12. Variables defined outside of functions are not available inside of functions. You need to use function arguments to get values in, then return whatever single value you want out of it.
  13. array_merge will renumber arrays if they have numeric keys. Are your product_codes numeric? Honestly, all that code is far more complicated than it needs to be. You're checking if the product_code exists in the cart so you can update its quantity, and then you run a loop over everything in the cart? And when you want to add the (new) item to the cart, you use array_merge instead of just adding the item directly to the cart array? Try spending some time thinking about what's happening in there and whether there's any way you can reduce the number of lines to, say, half of what's there now.
  14. Precedence is like automatic grouping with parentheses. You know how multiplication has higher precedence than addition? That's why 1 + 2 * 3 is 7 and not 9: because it's like 1 + (2 * 3). Since ?? has higher precedence, the statement seems like it should do return ($cache[$class] ?? $cache[$class]) = new $class;
  15. Oh. About shortening code, it can go one step further: static $cache = []; return $cache[$class] ?? $cache[$class] = new $class; If you want to have a good time, figure out how that works. If you want to have a really good time, figure out how that works given that ?? has higher precedence than =
  16. +1 to $cache. Because that's what it is.
  17. Splunk should be returning to you XML, not text. What is a sample of the XML? There's a better way to search for the DHCPACK than regular expressions.
  18. Do not optimize for memory unless you're running in a constrained environment. Which you aren't. PHP is perfectly capable of cleaning up unused variables. This design pattern is fine as long as you're using it for the right reason: because each $unit/$class should only ever be created once (in this context) and it's acceptable, if not desirable, to reuse instances in multiple places. Without knowing your usage, I would expect that it's better not to use a registry/singleton pattern like this, and that you should be creating and destroying data as needed. Also: that's not a stack so don't call it one.
  19. Let me pull out the PHP code and narrow it down for you: ?schoolname={$school_page}?action=add
  20. <form action="student_order.php?schoolname=<?php echo $school_page; ?>?action=add&product_code=<?php echo $product_array[$key]["product_code"]; ?>" method="post"> Take a very, very close look at that line.
  21. The easiest option is to split your file into two parts: one for all the content before the external_block (including the opening tag for it) and one for the content after it (including the closing tag). Put each into a function. Then your regular scripts include this common file, call the first function, output what they want, and call the second function. To pass information into the header, like the title of the page, use function arguments.
  22. Multiple possible issues here, but to aim for the one that's on-topic: You cannot redirect and output a message at the same time. Only one can happen. I don't know your application or how this script is being used, but my first suggestion would be to forget the redirect and instead show a whole HTML page with the message.
  23. I feel like I need to emphasize the last thing I wrote a little bit more. By using URLs like /ClientOrganizationName, where you have only one "segment" of the path, you are limiting what you can do in the future. Anything else that's one segment will look like a company name. That means you can't do stuff like /about or /Contact-Us because those will look like companies. You should namespace the URL so that you can safely dedicate the entire pattern to companies without worrying about it conflicting with anything else. Doesn't have to be complicated. I'm thinking like /shop/ClientOrganizationName: you're able to add a new keyword in there and it's still easy for anyone to understand.
  24. You can definitely do /ClientOrganizationName being treated as /productpage.php?companyName=ClientOrganizationName. Note the two names are the same. The concept is called URL rewriting and there's a lot of information on the internet about it. What you do is tell your web server that requests for a URL in a certain pattern should be "rewritten" to another URL. In your case, you would tell it that a URL that is a name without any "directory" (so /Client matches but not /foo/Client or /Client/foo) takes that name and gives it to productpage.php. If you're using WordPress, IIRC it has a URL rewriting feature by itself (the web server was told that everything should go through WP, and then WP itself decides what to do) so you would tell WP that pages in that pattern should be treated a certain way. There is one restriction, though: this URL pattern needs to be dedicated to this one particular feature. Otherwise the URLs would be ambiguous.
  25. Try explaining what your problem is using paragraphs and complete sentences.
×
×
  • 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.