Help - Search - Members - Calendar
Full Version: PHP, MySQL
HTMLHelp Forums > Programming > Databases
akeredolujosh
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
jimlongo
There's 2 parts to this.

The query itself which is a MYSQL task
assuming id is the primary key. A mysql join 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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.