Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. I already gave you the answer: if (isset($_POST['submit']) should be if (isset($_POST['username']) && isset($_POST['password']))
  2. Sure change if (isset($_POST['submit'])) to if (isset($_POST['username']) && isset($_POST['password']))
  3. I don't understand what you mean, try http://en.wikipedia.org/wiki/Vector_graphics
  4. Yup it will return the appropriate object and as they all come from the same mother they all share the same functionality. $db = DatabaseAbstractFactory::factory('mysql://ignace:password@localhost/database'); $db->execute('SELECT * FROM table'); echo get_class($db);//MySQLAdapter $db2 = DatabaseAbstractFactory::factory('mssql://ignace:password@localhost2/database'); $db->execute('SELECT * FROM table'); echo get_class($db2);//MsSQLAdapter Neat ha
  5. a vector image doesn't use pixels, it uses (mathematical) vectors you'll notice the difference when you zoom
  6. What do you mean by writes a lot of threads? You can use: For each user and allow only an admin access to the actual table_name (UPDATE, INSERT, DELETE)
  7. It could be as simple as.... class DatabaseAdapterFactory { public static function factory($type, $user, $pass, $server, $db) { select ($type) { 'mysql': $db = new MySQLAdapter($server, $user, $pass, $db); break; // etc etc for each type } return $db; } } $db = DatabaseAdapterFactory::factory('mysql', 'foo', 'bar', 'localhost', 'example'); select?? seriously, stay away from VB we use switch here
  8. If you know the database name you can do: SHOW TABLES [FROM database] or if you don't: SELECT count(*) FROM information_schema.tables WHERE table_name = <table-or-view-name> Credits: http://forums.mysql.com/read.php?101,33936,34067#msg-34067 http://forums.mysql.com/read.php?101,33936,34090#msg-34090
  9. That's the idea It's possible that your adapters will share certain common functionality, these should go in the abstract class. If you don't have any common functionality skip the abstract class and use the interface instead. interface DatabaseAdapterInterface { const MODE_NUM = 1; const MODE_ASSOC = 2; const MODE_BOTH = 3; public function connect(); public function disconnect(); public function query($sql); public function fetchAll($mode = self::MODE_ASSOC); public function fetchRow($mode = self::MODE_ASSOC); } abstract class DatabaseAdapterAbstract implements DatabaseAdapterInterface { public function fetchAll($mode = self::MODE_ASSOC) { $rows = array(); while ($row = $this->fetchRow($mode)) { $rows[] = $row; } } } class MySQLAdapter extends DatabaseAdapterAbstract { //@see DatabaseAdapterInterface } class MsSQLAdapter extends DatabaseAdapterAbstract { //@see DatabaseAdapterInterface } The fetchAll does not use any specifics (mysql_* or mssql_*) and can therefor be used as an abstraction as the implementation most likely won't change in child classes
  10. Your setup should do it: categories (id, name) subcategories (id, category_id, name) Just perform a SELECT count(*) FROM subcategories to see how many subcategories a user has left to create.
  11. Actually you can do this better and faster using mjdamato's function. $_POST = array_map('clearZero', $_POST);
  12. ignace

    Education

    Yeah, but I am sure you won't find anyone drunk in Denmark or Norwegian.
  13. Those fees do not come to you in contrary you may be sued as well as you were clearly aware of the nature of the project.
  14. <form action="#" method="POST"> <input type="submit" name="submit"> </form> if (isset($_POST['submit'])) { echo "submit was pressed."; }
  15. he uses = that doesn't return a bool rather the assigned value (in this case a string). See, VB is bad for your health. In the second you assign the value to an internal class variable. Both return your input "Some value".
  16. The website is not the customers desktop background. Focus on content and usability first, before you start adding features that mean nothing to your client. Not to mention this technique also has serious usability problems 1) you can't stop it from switching 2) it distracts the reader 3) slurps away bandwidth. Indeed, good catch. Not a problem, just don't forget to pre-load the images though. This is all nice and dandy but have you thought about those that don't have JS enabled (eg NoScript add-on)? So when they visit your client's website they see an image of a lawn, nothing more. I am sure that will generate many leads for your client. Like I said before your focus should be on content and usability. Your primary goal is to generate leads for your client. He will be more happy when he has to sub-contract people because he can't handle the load of customers then when he would when he can move the website's content in either directions but no single customer calls him.
  17. You mean a Sub under a Sub under a Sub under a Sub ..? Most use the Adjacency List Model although there are better alternatives like a Binary Tree: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
  18. Also referred to as YAGNI (You Ain't Gonna Need It)
  19. ignace

    Education

    Thank you, I didn't knew if bruto was translated too or not in English. As you've already noticed I pride myself in using acronyms. TLA FTW! YWDYDT? S, DYGAKOONOBATUWYAS? DYCSTH, WYT? IMTP, AAIAPAWAAGOIWWUWYMWYSTW, LFO. AITUT.
  20. How do you exactly mean? x amount of total (parents + sub)? or x amount of parent? or x amount of sub?
  21. You would use a Abstract Factory- (or Factory Method) and Adapter pattern, like: class DatabaseAdapterFactory { public static function factory($adapterName) { //@returns any child of DatabaseAdapter } } abstract class DatabaseAdapter {} class MySQLAdapter extends DatabaseAdapter {} In your program you would use it like: $adapter = DatabaseAdapterFactory::factory('mysql://ignace:password@localhost:3610/database'); The 'mysql://..' comes from your config.php (you parse it with parse_url)
  22. ignace

    Education

    And the price of beer is ridiculous! It was when I went to Copenhagen anyway. They care about your health, cola is much cheaper
  23. No, you can adhere to the Agile development philosophy and that's to start out small by the things you know you need now, you implement new features as you gain a deeper understanding of the domain-model (the knowledge on the subject) like roopurt's suggestions or mine.
  24. ignace

    Education

    Thank you, I didn't knew if bruto was translated too or not in English.
×
×
  • 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.