Please I have two different tables namely Land owners and property respectively with the following columes:
table 1: Land owners > Columes are: id, fileno, type of ownership, firstname, last, sex.
table 2: Property > Columes are: id, fileno, doe, plotno, location.
Please how can i use php to display the data on both tables of which the data on fileno colume on both table are the same
There's 2 parts to this.
The query itself which is a MYSQL task
assuming id is the primary key. A http://www.w3schools.com/sql/sql_join_left.asp something like the following should get you started.
SELECT * L.id, L.fileno, L.type of ownership, L.firstname, L.last, L.sex, P.doe, P.plotno, P.location from Land owners as L join Property as P on L.id = P.id
and if your columns and table names really have spaces in them you're going to need to use some form of quotes or back ticks.
Then you have to figure out how to use PHP mysql, and nowadays people are generally recommended to use mysqli or mysqlPDO, but you can still use the mysql interface.
You connect to the database.
You make a variable that is the query.
You pass the query variable to mysql.
You iterate through the result set and print it out, or whatever it is you want to do with it.
hope that gets you started.
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)