Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Databases _ PHP, MySQL

Posted by: akeredolujosh Mar 3 2014, 08:40 AM

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

Posted by: jimlongo Mar 3 2014, 01:37 PM

There's 2 parts to this.

The query itself which is a MYSQL task
assuming id is the primary key. A something like the following should get you started.

SELECT *, L.fileno, L.type of ownership, L.firstname, L.last,, P.doe, P.plotno, P.location from Land owners as L join Property as P on =

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 (
© Invision Power Services (