Jump to content

Recommended Posts

Hi,

 

There are only 3 different user types.

 

How can I query multiple tables. When I try "table, table1" this doesn't work but it seems a simple way of doing it.

 

$query = 'SELECT * FROM users, users1 WHERE email = "' . mysql_real_escape_string($loginEmail) . '" AND password = "' . $loginPassword . '" LIMIT 1';
	    $result = mysql_query($query);

And for the record, I have created websites similar/identical to your needs. One site in particular which housed real estate listings, rental listings, vacation rental listings, foreclosure listings, and the like. Each category has different data (rentals differ greatly from for sale listings; vacation rentals differ drastically from them all, and so on), but I created only one single `users` table.

 

Then, within the rest of your site, if a person is dealing in vacation rentals, when they login that is noted and they will then be JOIN'ed to the available `vacation_rental` tables. Same of the other categories.

Hi,

 

There are only 3 different user types.

 

How can I query multiple tables. When I try "table, table1" this doesn't work but it seems a simple way of doing it.

 

$query = 'SELECT * FROM users, users1 WHERE email = "' . mysql_real_escape_string($loginEmail) . '" AND password = "' . $loginPassword . '" LIMIT 1';
	 $result = mysql_query($query);

 

Radio box or dropdown select box. User selects what area they would like to login to.

Thanks, I made those changes and it works fine.

 

In terms of the different user groups I cant see what the issue is. It makes the makes the site much easier to manage.

 

Lets say for example you make a site for hotels and travellers. The fields would be completely different. For example:

 

Traveller: Favorite Destination, Budget,

 

Hotel: Location, Images, Costs, Number of Rooms, Facilities

 

Putting these together would make a more complicated table. I cant see why anyone would want to mix these two tables together.

Just out of curiosity - what's the weather like on that planet your living on? Most of the people who have advised you here have actual proffesional experiance managing systems and applications hundreds if not thousands of times more complex than the basic program you are having such trouble with, and yet you know better? These same people are the ones that have to go in and fix the kind of crap design you are insisting on writing, and you expect them to go and encourage someone new to do it all over again? I could write you a single query that would lookup all your tables at once and give you the results you want with my eyes shut, standing on one leg on a rainy day - but I'm not going to encourage you to do something that is fundimentaly wrong.

Putting these together would make a more complicated table. I cant see why anyone would want to mix these two tables together.

 

Of course you can't. You refuse to listen.

Just out of curiosity - what's the weather like on that planet your living on? Most of the people who have advised you here have actual proffesional experiance managing systems and applications hundreds if not thousands of times more complex than the basic program you are having such trouble with, and yet you know better? These same people are the ones that have to go in and fix the kind of crap design you are insisting on writing, and you expect them to go and encourage someone new to do it all over again? I could write you a single query that would lookup all your tables at once and give you the results you want with my eyes shut, standing on one leg on a rainy day - but I'm not going to encourage you to do something that is fundimentaly wrong.

 

I just have to say: A. Men. Brother.

 

 

It must be down to my inexperience then.

 

Putting all the fields into one table sounds like a daunting task. For example if I wanted to allow a basketball fan to upload a total of 5 images and a soccer fan to not be able to upload any images whatsoever I have to design two different pages but then use the table differently for each page.

 

What I have done so far is to design two pages based on the content of two tables. I found this quite easy to do.

 

Im not treating the 3 user groups equally because they will have different uses for the site. Thats why I split them up.

It must be down to my inexperience then.

 

Putting all the fields into one table sounds like a daunting task. For example if I wanted to allow a basketball fan to upload a total of 5 images and a soccer fan to not be able to upload any images whatsoever I have to design two different pages but then use the table differently for each page.

 

What I have done so far is to design two pages based on the content of two tables. I found this quite easy to do.

 

Im not treating the 3 user groups equally because they will have different uses for the site. Thats why I split them up.

 

At the end of the day you need to figure out if development is the path you wish to pursue as a career. If not, then feel free to continue with your coding style and logic. If you do wish to continue, you must start following proper logical design practices, especially when numerous pro's are advising you.

 

Currently, you're taking the path of least resistance as you see it. However, what *might* be a little extra work (in your head) will allow you to build applications for use in large scale environments. With your current design, there is not a single developer who would be willing to work on that project (that I know of, anyway).

 

One day, hopefully sooner than later, you will come around and start taking the advice of people who have "been there, done that". It's in your best interest.

that's why you have a user table and a group table, as I posted here already.

user

user_id

name

password

group_id

status

etc.

 

Group

group_id

group_name

image_upload_count

default_background_path

etc.

 

While you keep saying it's very unlikely that a user would ever change group, you are admiting that it is a possability and as such should be accomidated. This isn't about making things easy, if you want things easy you have the wrong passtime. This is about solving problems with the best solution that you can create. Using a relational database to store your information is effictivly pointless if you're not willing to learn how do do it properly. You would be just as well making static arrays in your code or using flat files on the server. The advice that has been given to you is designed to make your solution better. We don't activly seek to make life hard for people just for the fun of it. If you can open your mind and expand your point of view you can get a lot out of this forum, if you can't people are going to ignore you because lets face it - what's the point in trying to help someone who refuses to be helped?

 

I'm going to take a last ditch atempt here :

You only have a single user table because you only store the same information that is specific to each actual user. As you have different groups of user (lets keep with the basketball and soccer) you then need a single group table that will store the information that is specific to the group. Just because a users experiance is dictated by their group doesn't meen you creat a new users table for each group. what if you were designing a site that responded differently to people of a different height? You think it would be easy or efficient to make a table for every inch between 3 foot and say 10 foot?

 

Honestly, 1 user table + 1 group table = the way to do this

Thanks, Ive never heard of group tables.

 

I've never heard of these points or know how or why I would want to use them:

 

group_id

group_name

image_upload_count

default_background_path

 

 

Thats say I had designed for professional basketball players, boxers and soccer players would groups would I use and why?

Guys, this guy is clearly a troll. He's been a member of this site for 5 years and still doesn't understand basic database design, any coding principles, or even basic logic. He consistently "asks" for help, disagrees with the help for pages, then when he decides to try the right way acts like he can't understand english. 

 

I call foul. 

Guys, this guy is clearly a troll. He's been a member of this site for 5 years and still doesn't understand basic database design, any coding principles, or even basic logic. He consistently "asks" for help, disagrees with the help for pages, then when he decides to try the right way acts like he can't understand english.

 

I call foul.

 

Thinking you may be on to something here. Feel like I'm running around in circles with this guy on numerous threads.

Guys, this guy is clearly a troll. He's been a member of this site for 5 years and still doesn't understand basic database design, any coding principles, or even basic logic. He consistently "asks" for help, disagrees with the help for pages, then when he decides to try the right way acts like he can't understand english.

 

I call foul.

:qft:

Thanks, Ive never heard of group tables.

 

I've never heard of these points or know how or why I would want to use them:

 

group_id

group_name

image_upload_count

default_background_path

 

 

Thats say I had designed for professional basketball players, boxers and soccer players would groups would I use and why?

Dude, they are column names in a table called groups (or anything else you would want call it, use "sports", or "game_type" or something else if it's appropriate), they store the information that dictates what makes one group different from the rest. I'm only going to keep up with this so far because your ripping a hole out it now. It's genuinely about as simple as this :

 

known physical elements can be in one of three states at room temperature - solid, liquid, gas - so rather than your concept of having a solid table, a liquid table and a gas table I say have an elements table which will have a field in it that holds stateID so

 

PeriodicNo | ElementName | StateID

1 | Hydrogen | 3

 

then have a state table (this is the one that like the sports or group table) with the following

 

StateID | State@RoomTemp

1 | Solid

2 | Liquid

3 | Gas

 

See how that works?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.