Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Don't think, measure! There's a big difference between having and assuming you'll have 20 million records. In either case it won't hurt to dive into serious MySQL administration and learn it's different engines and their differences, indexes and how they work and how to find bottlenecks, replication, .. High Performance MySQL and SQL anti-patterns should lead you through the maze!
  2. You sure you read the article?
  3. Your database table should be like: CREATE TABLE words ( user_id INT NOT NULL, word_id VARCHAR(24) NOT NULL, -- http://en.wikipedia.org/wiki/Longest_word_in_English PRIMARY KEY (user_id, word_id) ); When someone enters some text, run it through some class that strips common words and sort all others in descending order by the number of occurrences. Take the top-5 (array_slice) and run it through your database: SELECT first_name, last_name, email_address FROM words JOIN users USING (user_id) WHERE word_id IN (..) Don't worry about stuff that isn't yet important.
  4. http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
  5. Or do you mean something like? http://kodingen.com/
  6. There's no need for javascript: http://www.cssplay.co.uk/menus/dd_valid.html
  7. That may sound cool but your users will either 1) ignore your website (we don't want to graduate from your website) or 2) stop bothering after they see a third fly-out menu with sub-navigation. Your only concern in whatever you build: USABILITY + google doesn't like websites with too many links on one page
  8. Thanks for the link
  9. interface MyBatchService { public function someMethod(); } class SomeService1 implements MyBatchService { private $successor; public function __construct(MyBatchService $successor) { $this->successor = $successor; } public function someMethod() { if(!$this->canHandle()) { if($this->successor) return $this->successor->someMethod(); throw new Exception('Failed to handle the request'); } } } class SomeService2 implements MyBatchService { private $successor; public function __construct(MyBatchService $successor) { $this->successor = $successor; } public function someMethod() { if(!$this->canHandle()) { if($this->successor) return $this->successor->someMethod(); throw new Exception('Failed to handle the request'); } } } class SomeService3 implements MyBatchService { private $successor; public function __construct(MyBatchService $successor) { $this->successor = $successor; } public function someMethod() { if(!$this->canHandle()) { if($this->successor) return $this->successor->someMethod(); throw new Exception('Failed to handle the request'); } } } try { $batch = new SomeService1(new SomeService2(new SomeService3())); $batch->someMethod(); // initialize the chain } catch(Exception $e) { echo $e->getMessage(); } I assume each service returns the same information. The interface declares the common interface eg getUser(..) If a service fails to be able to handle the request (due to overload) it will try it's successor until the request is successfully handled or an exception is thrown.
  10. SELECT amount, quantity, amount * quantity AS total FROM orders WHERE customer_id = .. GROUP BY amount, quantity WITH ROLLUP *MAGIC*
  11. I'll need some more information. The above form is filled out by the customer? Each company has different plans? You want to find matches for each selected company and criteria?
  12. Yes, your comments are correct.
  13. fetchDelicious() takes a JSON encoded string and transforms it to a list in html. The .replace(':u', ..) and likes seem overhead IMO. var config = {}; Creates an object literal like [] creates an array literal. window.onload = function() {}; Attaches a function to execute upon window has been loaded. The function used is a closure: any variables that exists within it's parent scope are automatically copied into the function's scope. var helloWorld = 'Hello!'; var hello = function() { alert(helloWorld); }; hello();
  14. Or a better example: At some point in time you write: if(isset($_POST[txt_username])) { // bla } At some later point in time you add translations to your code: define('TXT_USERNAME', 'Type your username:', true); And now your code breaks. if(isset($_POST['Type your username:']))
  15. I found a bug: When I try to register it says: So, when I try to recover my password I get:
  16. Can you provide us with some test data (create table, insert into) so we can experiment to get the correct values?
  17. Like he said, it can no longer be manipulated
  18. I agree with monkeytooth. Make sure you have proper validation set up.
  19. Use SQL_CALC_FOUND_ROWS to find out how many exactly are in the result.
  20. I haven't been able to test it but try and experiment with this: SELECT cust.id, cust.name, (SELECT date FROM payment AS t1 WHERE t1.item_id = item.id AND t1.customer_id = cust.id ORDER BY date DESC LIMIT 1) AS last_payment, (SELECT sum(amount) FROM payment AS t2 WHERE t2.customer_id = cust.id AND t2.item_id = item.id) AS total_paid ((item.price / item.weeks) * 4) AS monthly, (item.price - total_paid) AS left_to_pay, item.weeks AS max_weeks FROM customer AS cust JOIN item ON customer.id = item.customer_id JOIN payment AS pay ON customer.id = payment.customer_id
  21. Try that again but this time use: It will show you: Which means the query was invalid and mysql_query() returned false. It also means there is no validation on the result between the query part and mysql_num_rows() part. To the OP: I didn't hack your website or caused any damage I merely entered some information of which I know MySQL won't execute.
  22. Pikachu don't get greedy, you already asked one from Santa-Claus.
  23. Should be straight-forward: members (member_id) friends (member_id, friend_id, status) It should also be noted it works in both ways: if you and a friend both state you are friends then he will not only appear on your profile but also you will appear on his.
  24. I have encountered the same problem. Making the path absolute instead of relative solved it.
  25. http://framework.zend.com/manual/en/zend.form.html I wrote this just for you, took me a day or two of serious typing. I also created an entire framework to accompany it.. while I was at it.
×
×
  • 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.