Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. So what doesn't work now? I'm lost.
  2. I don't understand... you're already necessarily iterating through all of the results, why make mysql do more work?
  3. Yikes -- why the redundant index? Anyway, we generally prefer pastebin to random IPs. But define "wrong".
  4. That's what PHP is for.
  5. Yes, it's pseudo-code -- you have to capture the errors from mysql.
  6. Sigh.... SELECT *, (SELECT COUNT(galerija.kat_id) AS cnt FROM galerija WHERE kat_id = kategori.kat_id) as cnt FROM kategori WHERE kat_parent = 1;
  7. I don't need an example -- you need to make an column alias called "cnt", or there won't be one.
  8. Not to burst your bubble, but you could save a DB query by simply grabbing the teams from the 2nd query.
  9. Sorry, my bad, cut and paste error: Try this: SELECT a.user, a.exp_attack AS Attack, @num := @num +1 AS Rank FROM `rscd_experience` a, ( SELECT @num := 0 ) b GROUP BY a.user ORDER BY a.exp_attack DESC
  10. Well, there are some excellent resources in the "sticky" if you're looking for a place to start.
  11. I don't see a column alias ANYWHERE.
  12. Your dates WILL be a problem -- use a proper DATE column type, and use DATE_FORMAT() to get it displayed how you'd prefer -- you'll thank me later. But I digress.... you're using ON DUPLICATE KEY UPDATE incorrectly. if you use VALUES(), you need to refer to the column name, not the value.
  13. And if you only want 3, use LIMIT.
  14. FULLTEXT will return nonsense unless 50% of the rows have matches.
  15. Unless there is a duplicate key, use update -- impossible to tell since we see nothing of the actual database.
  16. Or you can set the variable as part of the query directly: SELECT a.user, a.exp_attack AS Attack, @num := @num +1 AS Rank FROM `rscd_experience` a, ( @num := 0 ) b GROUP BY a.user ORDER BY a.exp_attack DESC
  17. How many rows total?
  18. Well, have you set up the primary tables?
  19. And you're only connecting once per script?
  20. Then dump the row.
  21. Wrap your queries in parens.
  22. You'll have to recompile mysql.
  23. Really?
  24. Combine how? I don't follow.
×
×
  • 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.