PDA

View Full Version : Checking if an sql table exists?


FethrdWlf
05-11-2011, 01:53 AM
I have decided to setup a new table for each person to register for my site. This allows them to have multiple messages in their inbox, because now they each have an entire column to store them in (as opposed to each user having one row for everything, they have infinite numbers).

The problem is though, I need to check if a there is - out of every table - a specific set of rows. Basically, when someone makes an account, an entirely new table is devoted to them. When they login, I want to search every table to find if there is a matching row containing the entered username and password. Could the query be written like...

SELECT * FROM * WHERE username = '$entereduser' AND password = 'password'

mangofreak
05-13-2011, 11:57 PM
I'm no genious but I would go about it this way:

create a table only for messages - with the following fields:

messageID
userID
messageSubject
message


you make a relationship to the Users table with the userID and that would allow you to save any number of messages.

To view a specific user, you just call it by passing the userID, does it make any sense?

I don't think there is need for creating one table per user. that's MHO.