Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. PHP definitely doesn't have anything like that out of the box. That said, I'm still a bit confused about how the components should interact. What the workflow should be. Is it as simple as just wanting to send some GET values from PHP to the service? If you can expand on how the whole thing should work, I may be able to point you in the right direction.
  2. I'm afraid most of us aren't familiar with .NET. I've dabbled in webforms, and do MVC work (C# for both), but haven't touched WPF. How is this supposed to work? Can the WPF component simply accept POST data, or is there more to it? What should the PHP side do?
  3. It's difficult to see the problem (aside from you opening a <div> before your <html> tag) because you echo the majority of your HTML, causing it to be one long line of unformatted code. You're much better served doing all of your data processing first, storing the results in variables, and then writing a real HTML page where you can simply plug those variables into the appropriate spot. That will allow you to format your code, making it easier for everyone to read.
  4. Works fine for me: $a = array("pigs", "horses", "cows", "chickens"); foreach($a as $k => $v) { $a[$k] = "$v and "; } $i = substr(implode($a), 0, -4); echo $i; pigs and horses and cows and chickens That said, jcbones' solution is better.
  5. Try: // array for-loop $imploded = substr(implode($a), 0, -4); // remove and_ from the end $_SESSION['changed'] = "You have changed $imploded";
  6. Because they're poorly engineered POS? WordPress is immensely popular, too. Doesn't stop it from being a complete war zone under the hood. Do yourself a favor and get the following books: PHP Object, Patterns, and Practice by Matt Zandstra Design Patterns: Elements of Reusable Object-Oriented Software by the Gang of Four And look up the term 'Dependency Injection'.
  7. There's never a need to use 'global'. Argument lists exist for a reason. It's especially egregious to use 'global' in an OOP setting, as it creates a hidden link to an outside context, thereby coupling the object to its environment. Simply put, if you're using 'global', you're doing it wrong.
  8. It is working. 0 is the first position in the string.
  9. ...totally misread what you were asking for. Thought you were talking more about a "Look what I did. Crits?" area than an actual help area. Yay 1:00 AM reading comprehension!
  10. Remember, we're a PHP forum first, generalized web development forum a distant second. Any graphic design subforum would have to fit into that. To me, that's what 'Website Critique' is for, since graphic design tends to mean layout when constrained to our focus. Non-web designs would really only fit in our 'Miscellaneous' section. IMO, that means a graphic design subforum is unnecessary.
  11. Our infrastructure is crap across the board. Failing bridges, tunnels, dams, water mains, sewage, etc. And then, there's the empires and small feifdoms of the large and small cable providers. And, of course, local laws that strangle business. I live in area that will never get FIOS due to my state's laws. Verizon only exists as a cell carrier here. No land line phone, no cable, no internet. My internet provider has three plans, and I use the middle tier. It ranks a D on Speedtest.
  12. Yup. And, really, if you're going to do anything with OOP, you should learn the basic patterns. Basic SQL is more or less the same across db engines. That said, they all have their own unique spins on things. No two are exactly alike. But, a SELECT is a SELECT. Just be sure to write as little db engine dependent code as possible.
  13. Sounds like a front controller. You don't need a singleton or static class. Since this class lies at the top of your app, and simply dispatches to other objects, a normal instance would work just fine.
  14. Does the API need to remember anything, or hold anything within internal variables (state)? Is it used directly by other objects, as in: class SomeObject { function someMethod($api) { $api->doSomething(); } } ? A singleton, static class, or dependency injection are all options, but I can't recommend one over the other without knowing how you intend to use it.
  15. RE: your API class - are you going to be retaining any state? Do you need an instance? Is it passed around or used anywhere else?
  16. RE: your database - why not simply use or extend PDO as your abstraction layer? You're attempting to recreate something that already exists within the language.
  17. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=350881.0
  18. And then there's securing it....
  19. Yes, because you have multiple inputs with the same name they form and array inside the $_POST array. That's only if you use array notation. A bunch of inputs with the name "playerName[]" will form an array. A bunch of inputs with the name "playerName" will result in only the last one being 'seen'.
  20. Take a look at how PaulRyan wrote the form. Note, specifically, "playerName[1]", "playerName[2]", etc. Using array notation tells PHP to handle all playerNames as an array on POST.
  21. Exactly. $array[$row][$column]
  22. Foreach iterates over an array. There are two possible forms: foreach ($array as $value) { // do something with each individual array value } and foreach ($array as $key => $value) { // do something with each key/value pair } $array can be any array you want to iterate over. You'd simply use its variable name in place of $array. $key and $value are what are returned during the process. You can name them any legit variable name. In the example above, $_POST['playerName'] is itself an array. $id is each array key, and $name is each array value at $_POST['playerName'][$id].
×
×
  • 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.