Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. Funny stuff. You should probably get some facts right first, and then ask your question in a more appropriate place.
  2. Maybe if you explained "what" it is your trying to do rather than "how" your trying to do it someone who knows what they are doing could offer a better solution. As it stands, your code is pretty bad I'm sorry to say.
  3. trq

    LAN scan

    Where is your code and the description of where you are stuck?
  4. Another option: <?php $a = [1,3,5]; $marker = 1; $new = array_merge(array_splice($a, $marker), array_splice($a, 0, $marker)); foreach ($new as $val) { echo "$val\n"; }
  5. Static methods are very much frowned upon by most people designing OOP applications. Why? Because they promote tight coupling of components which in turn makes code hard to test. While it may seem to simplify things at first, it just makes larger applications harder to wrok with and more prone to bugs. I would never recommend going down the static path, especially for something like a DBAL.
  6. You using classes/functions wrong. Either forget the global keyword exists and pass your data as arguments, or give use global code. Functions, Classes/Methods are designed to encapsulate code. The global keyword is designed to break that encapsulation.
  7. The error is pretty straight forward. You are trying to insert 4 values into 2 columns. darkfreaks: If you can answer the question at hand please do, otherwise, leave the thread to people who can. We really don't need every thread around here having you highlight deprecations. Like your security scanning replies, it's going to get pretty old pretty quick.
  8. You could also put the class in a namespace which removes this backward compatibility. <?php namespace Railway; class Train { public $train = "e train"; public function train() { echo "I am in the " .$this->train; } } $train = new Train; $train->train(); On a side note, use "public" in place of the older "var" keyword and you should also be explicit about your methods visibility IMO.
  9. Look at the logic of your code. The first iteration will produce: SELECT * FROM Users WHERE UserID <= 1 The second: SELECT * FROM Users WHERE UserID <= 2 All the way up to 60. Why not just use: SELECT * FROM Users WHERE UserID <= 60 In the first place? Executing multiple queries when you don't have to is inefficient. You can loop through all results returned. w3schools is terrible. Get yourself a decent book.
  10. I'm not sure what your problem is exactly. You can use PHP to create a file uploading quite easily, where exactly are you stuck?
  11. Probably not, but why would you use such terrible code? There are more efficient ways of doing this.
  12. SELECT GROUP_CONCAT(Part_Name SEPARATOR "','") AS parts FROM Litem GROUP BY Part_Name
  13. If you can't come up with a convincing enough argument yourself, maybe the idea isn't as appealing as you think.
  14. Why do you want your urls to have "lots of numbers" on the end? What exactly do you plan on doing with these numbers? People don't just tack numbers onto urls for no reason.
  15. I don;t think so. It's a very simple pattern.
  16. What an unfortunate name for a library, if that is indeed what you are referring to. Ive never heard of it.
  17. No ofense, but MVC is a very simple pattern that can easily be implemented without any OOP.
  18. Unless class2 is a type of class1 that would be incorrect. The best method is to use dependency inject. Either via the __construct, or as an argument to the method itself. eg; <?php class class2 { protected $class1; public function __construct(class1 $class1) { $this->class1 = $class1; } public function get() { echo $this->class1->str; } } $c2 = new class2(new class1); $c2->get(); [/code] or [code] <?php class class2 { public function get(class1 $class1) { echo $class1->str; } } $c2 = new class2; $c2->get(new class1);
  19. XCache is an alternative to APC, and in fact Symfony2 has the same mechanisms in place to make use of XCache as it does with APC. Some of these things however need to be setup / configured by the developer. They don't just work out of the box. the same applies to Symfony's use of APC though.
  20. You will need to know PHP and OOP design principals before you learn any framework.
  21. pfff. There is a big difference between knowing HTML and CSS and being able to design. They are different things all together.
×
×
  • 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.