DonaldFaulknor Posted February 1, 2012 Share Posted February 1, 2012 I'm pretty sure I can probably handle the php myself, I just need to know how is the best way to set up a database for a message other users option. I was thinking Messages Table... ID - Auto Inc, Primary To From Message Datetime/Timestamp And should there be any relationships? I currently have... users table - Register/Login system working Friends table - Friend feature working comments table - to comment on statuses - feature not set up yet statuses table - Statuses working, to include friend's statuses posting on your homepage Images table - Images upload and posting to your image page working Likes table - to like statuses - feature not set up yet The main thing I need to know is how is the best way to set up the messages table and any relationships needed. If someone wanted to write the create table query for me, I won't complain, honestly, I won't. Create table queries are easy for me, but I'm still kind of new to writing queries for relationships, I tend to have to debug errors 5 or 6 tries before I get it right - usually, stupid common syntax errors. And if a constraint is needed, please let me know how to work with that, everytime I try to add constraints, I just get errors I often can't figure out. Like I said, I know about writing queries, but relationships is new to me, have about 5 days experience with relationships. Thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/ Share on other sites More sharing options...
omfgitsaraver Posted February 3, 2012 Share Posted February 3, 2012 You should check out database normalization. http://en.wikipedia.org/wiki/Database_normalization Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1313956 Share on other sites More sharing options...
Adam Posted February 3, 2012 Share Posted February 3, 2012 No, we're not going to write it for you. Based on this thread and the last one I was involved with, you don't seem to want to understand the problem, you just want the solution. Even when I gave you the solution and explained it, given it didn't work 'out of the box' you just seemed to ignore it. Create table queries are easy for me, but I'm still kind of new to writing queries for relationships, I tend to have to debug errors 5 or 6 tries before I get it right - usually, stupid common syntax errors. Trial and error is all part of the learning process. If you're struggling with the syntax, keep the manual open for reference as you go. You'll soon pick it up. Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1313977 Share on other sites More sharing options...
DonaldFaulknor Posted February 3, 2012 Author Share Posted February 3, 2012 Well, when people in these forums "explain" things to me, they tend to complicate them MUCH more then they need to be. When given an answer, I can usually find out why it works that way. I learn better by knowing the answer and disecting it (teaching myself). But I appreciate everyone that tries to help me out. I'm just a lil frustrated since I've filled out 600 job apps in 6 months and no call, so, my only hope is self employment, since its not landscape season, I'm trying to get an internet thing going. I've been developing in html/css for 3 years, programming php for 1.5 years, and database relationships for a little over a week. So, I'm definitely lacking skills working with relationships. If only they had a way to work with relationships like Microsoft Access, then it would be easy lol Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1314048 Share on other sites More sharing options...
Adam Posted February 3, 2012 Share Posted February 3, 2012 If only they had a way to work with relationships like Microsoft Access, then it would be easy lol Somewhere in the world, something terrible just happened to someone. Don't ever say that again! Seriously they're not that difficult. The next time you get a problem, just post it here and someone will explain it I'm sure. If you don't understand what they're saying, just ask if they can explain it a little clearer. If they use buzz words or something that you don't understand though, you'd help yourself far more by looking them up and trying to understand what they're saying. Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1314054 Share on other sites More sharing options...
DonaldFaulknor Posted February 3, 2012 Author Share Posted February 3, 2012 I know they're not /that/ difficult, I just need to learn them. I was simply saying, someone, probably has the ability to make them /even/ easier. The main thing I'm not fully understanding about relationships is the ON clause. Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1314067 Share on other sites More sharing options...
Adam Posted February 3, 2012 Share Posted February 3, 2012 You mean in JOINs? That's essentially a WHERE clause for the join: where on (this.column = that.column) Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1314070 Share on other sites More sharing options...
DonaldFaulknor Posted February 3, 2012 Author Share Posted February 3, 2012 yes, in JOINs, I understand the ON clause to be the main part of the query, some call it the "glue" that connects the two tables. Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1314071 Share on other sites More sharing options...
Adam Posted February 3, 2012 Share Posted February 3, 2012 Yeah, it is more than just a where condition. When defining the foreign key, you say "this_table.column references that_table.column". The on clause is just a repeat of that logic, in a different syntax. Although if there's more joins in question or the data is particularly complex, you may need to add more logic to that expression - especially if the table you're joining has a second relationship to a different table. You're better off starting simple and working your way up. Quote Link to comment https://forums.phpfreaks.com/topic/256188-message-system/#findComment-1314080 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.