Member Avatar

Okie I have three tables.

1) for 'users' (UserID, Address, FirstName, LastName, Email,UserName, Password, UserLevel,Regdate)
2) for 'statement (StatementID, MonthID)
3) for 'tom_sawyer_db' (UserID, MonthID, TransacID,DateID,TransacName,Deposits,Withdrawal,Balance)

I would like to know how to link them up to get a table with
Date, Transaction, Deposits,Withdrawal, Balance for a month at a time for a user at time.

I have numerous users tom_sawyer_db is one of them. So after tom sawyer logs in, he will get to choose a monthly statement to display a table with his statements, and when clicked e will see only month of his statement data. I use dreamweaver so if you have an sql code how to link these tables please let me know.

Recommended Answers

All 4 Replies

Member Avatar


Member Avatar

trying to add a relational view of these tables


I am not sure if you are looking for the php code or the sql code but here is the sql code for what you need to do. You would either put a real values for the where clauses for Month selected and for userid from login or use php to put the current varible values there. To get January for Tom you would use:

from tom_sawyer_db
join statement on statement.MonthID = tom_sawyer_db.MonthID
where tom_sawyer_db.UserID = 4
and statement.MonthID = 1

Hope ths gives you something to work with.

Member Avatar

Thanks mate. But i found the whole idea of each user getting a database is wrong. i am implementing a new one call transactions where each user will be identified by same userid that appears in users table and same in transactions table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.