Member Avatar for sundeep.gurroby

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.

Member Avatar for sundeep.gurroby

no

Member Avatar for sundeep.gurroby

trying to add a relational view of these tables

Hello,

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:

select 
statement.StatementID, 
tom_sawyer_db.TransacID,
tom_sawyer_db.DateID,
tom_sawyer_db.TransacName,
tom_sawyer_db.Deposits,
tom_sawyer_db.Withdrawal,
tom_sawyer_db.Balance
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 for sundeep.gurroby

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, networking, learning, and sharing knowledge.