Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Can someone help out a brother?

edited December 2005 in Vanilla 1.0 Help
I'm just making a yearbook messaging system for school but i totally suck at UI design. Is anyone here willing to make me a really quick easy template as a christmas present? All i need is a nav with links to the send and view message pages, and a logout button. Any takers?

Comments

  • Also, this is probably a really simple question, but if i have a user id in the messages table, how can i use that to get the username out the users table within the same query? I'm guessing it's to do with JOINs and stuff but i've never got that complex with mysql before.
  • MarkMark Vanilla Staff
    select m.Message, u.Username from tbl_Message m inner join tbl_User u on m.UserID = u.UserID
  • Awesome thanks. *Goes to work out what it means and remembers for future reference.
  • NickENickE New
    edited December 2005
    So, what exactly is the difference between inner join and left join?
  • The INNER JOIN returns all rows from both tables where there is a match. If there are rows in table 1 that do not have matches in table 2, those rows will not be listed. The LEFT JOIN returns all the rows from the first table, even if there are no matches in the second table. :-)
  • /me thinks he understands but goes to read a couple more times for safety. Could i have used on m.UserID = u.UserID = $userID instead of using an additional where clause?
  • MarkMark Vanilla Staff
    I typically use left join just because things can muck up sometimes. But I really should be using inner join most of the time.
  • edited December 2005
    mini: No.

    WHERE takes both joins and conditionals, but JOIN (and INNER JOIN) only takes joins.

    m.UserID = u.UserID is a join.
    m.UserID = $userID is a conditional

    To be honest, I think this dual behavior of WHERE is kinda messy, but I use it myself mainly because I'm lazy. WHERE also makes it pretty unclear what kind of join it's using.
  • mark: Why?

    Left joins are not really any slower than inner joins, and it's usually a good idea to start with a pretty flexible join and move in, since it's far easier to spot extra invalid records than missing valid ones.
  • MarkMark Vanilla Staff
    edited December 2005
    Bergamot: My theory on the subject is that your data shouldn't be wrong, and an inner join will only return the records you need and not any "broken" records. The reality (as we both obviously know) is that you're better off seeing those "broken" records and taking some kind of action with regard to them. So, that's why I say that I should but I don't.
This discussion has been closed.