Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/27/2022 in all areas

  1. I'd criticise you for those too. Yes, you could have used "... FROM joined_chats jc, users u WHERE jc.user_id = u.user_id ..." but I dislike that method for several reasons. it confuses the row selection conditions with join conditions and obfuscates the structure of the query and its table relationships. That syntax can't be used for LEFT/RIGHT OUTER JOINS. Even if you want a cartesian join with no conditions, use tableA CROSS JOIN tableB to be explicit about what is required and you haven't just forgotten the WHERE bits. I have found queries using WHERE JOINS run slower than the same query using explicit JOIN .. ON syntax.
    1 point
  2. Overwriting your first $stmt object with the second one perhaps? A couple of DON'TS for you... Don't use SELECT * - specify just the columns you need. That makes it more efficient and people like us can see what the query is doing. Don't run queries inside loops like that. Use a single query with a JOIN SELECT jc.user_id , u.name FROM joined_chats jc JOIN users u ON jc.user_id = u.user_id WHERE jc.room_id = ? AND NOW() <= jc.date_expire ORDER BY user_id
    1 point
  3. If you're looking for an API-esque way of doing it, you can send URL params to this place and get an image back https://documentation.image-charts.com/
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • 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.