Jump to content

Search the Community

Showing results for tags 'favorite'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 1 result

  1. It would really help to have an outside view to what I am trying to do. I have 1 users table. 1 posts table and 1 favorites table. Basically what I am trying to do is give a user an option to add other users' posts to their favorites folder. Say these are the options for each table in mysql. users:: - id - username posts:: - post_id - user_id - title - post favorites:: - favorite_id - user_id - post_id Now I know I can use joins to join these tables together. I have tried them for other things and they work. It's just that with this particular case, I am having some issues getting the query right. This is my query. Please point out what's wrong with it and how to do it correctly. $stmt = $dbh->prepare("SELECT users.*, posts.*, favorites.* FROM posts LEFT JOIN users ON records.user_id = users.id LEFT JOIN favorites ON posts.user_id = favorites.id WHERE posts.user_id = {$userid} ORDER BY posted DESC LIMIT 4"); ps. $userid is definied outside of this query, so don't worry about 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.