Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. http://dev.mysql.com/doc/refman/5.5/en/replication.html
  2. $file = print_thumbnail($arr[$i]["thumb"]); // you forgot a ) $ext = pathinfo($file, PATHINFO_EXTENSION);
  3. $values = array_map('trim', explode(',', trim(substr($row['Type'], 4), '()'))); Returns: 'red', 'blue', 'green', 'white' surrounded with '
  4. Output Buffering is useful if: 1. You still want to send headers while output may exist 2. If you want to take advantage of ob_get_level() and thus nesting output (for example load all modules of a page before you load the main page) 3. You want to compress the output with g-zip ob_start('ob_gzhandler'); 4. Output has to go to more then one destination (screen, cache, ftp, ..) There are many uses for ob_ find one
  5. remove the backticks you don't need them in this particular instance.
  6. Please explain what you mean by queue process system as there are many ways to implement a queue system.
  7. Put the inactive accounts into an ARCHIVE database table. Write a script that performs the "upgrade" with the new database table. Execute that script whenever an old account has to be re-newed (admin section?). The only one that may support this is a Master/Slave set-up but I doubt you want to go for this more expensive solution. I also thought about Federated but that one doesn't do the trick as the master table can be different (in the number of columns) from the slave table.
  8. CREATE TABLE adjacency ( parent_id INT NOT NULL, child_id INT NOT NULL, PRIMARY KEY (parent_id, child_id) ) ENGINE = MyISAM; CREATE TABLE family ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(32) NOT NULL CHARACTER SET utf8 COLLATE utf8_bin, last_name VARCHAR(32) NOT NULL CHARACTER SET utf8 COLLATE utf8_bin, birth_date DATE NOT NULL, eol_date DATE DEFAULT NULL, -- day they died foto_filename VARCHAR(32) DEFAULT '', ) ENGINE = MyISAM; Insert all family members into the database table: INSERT INTO family (id, first_name, last_name, birth_date, eol_date, foto_filename) VALUES (0, 'Adam', 'Eve', '0000-00-00', '1970-09-05', ''), (1, 'Me', 'Self', '1996-09-05', NULL, ''); Specify the parent(s?)/child combination: INSERT INTO adjacency (parent_id, child_id) VALUES (0,1); -- parent.id 0 is the parent of all parents The query would look somewhat similar to: SELECT concat(parent.first_name, ' ', parent.last_name) AS parent_name, parent.birth_date AS parent_birth_date, parent.eol_date AS parent_eol_date, parent.foto_filename AS parent_picture concat(child.first_name, ' ', child.last_name) AS child_name, child.birth_date AS child_birth_date, child.eol_date AS child_eol_date, child.foto_filename AS child_picture FROM adjacency JOIN family AS parent ON family.id = adjacency.parent_id JOIN family AS child ON family.id = adjacency.child_id ORDER BY adjacency.parent_id ASC, adjacency.child_id ASC This should put you on your way. If you can give us a better idea as to how you want it to look we can adjust/advice more.
  9. REPAIR TABLE sessions; You should had been using InnoDB as an engine as it by design doesn't need repairing (it all takes care of that by itself).
  10. And that's why you need to make personal back-ups.
  11. Yup, you would add Canada under North America INSERT INTO region (id, ..) VALUES (1, 'North Ameria'), (2, 'Europe'), (3, 'Canada'); INSERT INTO region_adjacency (parent_id, child_id) VALUES (1, 3);
  12. Likely your customer is going to keep adding as the project grows. Look into an Adjacency List: CREATE TABLE region_adjacency ( parent_id TINYINT UNSIGNED NOT NULL, child_id TINYINT UNSIGNED NOT NULL, PRIMARY KEY (parent_id, child_id) ); CREATE TABLE region ( id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, .. PRIMARY KEY (id) ); Something like that.
  13. So the below is slower because you used double quotes Basically, it doesn't matter use whatever you fancy! And even if you run into performance issues this will not be one of those area's you'll be putting focus on. ${"type_".$i}
  14. No, I had it in college but I ain't keen referring to my teacher's books out of principle If you salt whatever your MD5 encrypting then there is no problem. Testers are your friends
  15. I have to disagree, ID's aren't as flexible as classes can be due to it's single usage.
  16. What you are trying to do is already built-in to MySQL SELECT *, MATCH(words) AGAINST($query) AS relevancy FROM table_example WHERE MATCH(words) AGAINST($query);
  17. If you take the necessary precautions and spend enough time tweaking/testing there is nothing to worry about. Don't forget that the PHP market - due to it's small learning curve - is polluted by "programmers". 1) Don't fix what ain't broke, your hash() function will still do. 2) There are books that explain encryption (if you ever feel the need)
  18. You should add a class to each div and an ID to those that require it (input, select, ..).
  19. I second what thorpe said but your function is_recursive() makes no sense at all. You can iterate recursively through an array but that doesn't make the array recursive just multi-dimensional.
  20. In PHP this may hold truth as almost everything is available through the extension library. However it is important to know this stuff if you look at implementations of encryption/decryption algorithms in order to understand them or if due to business needs you need to create an exotic implementation of your own. In the latter case you'll need a good understanding of encryption/decryption and bitwise operators.
  21. In fact it would be a good idea to do: public function __set($key, $value) { throw new Exception('Trying to set non-existent property "' . $key . '" on Object ' . __CLASS__); } To make sure your class is always properly used.
  22. If you give it a shotgun, it will!
  23. "If you are good at something, never do it for free." -- The Joker
  24. error_reporting(E_ERROR); set_error_handler('__error_handler'); function __error_handler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = array()) { error_log($errstr, 1, 'email@domain.top'); } // your script (use trigger_error()) This will log all dangerous errors in the error.log and mail all others to you
×
×
  • 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.