fetch

Fetch Data from Two or more Table Join using PHP and MySql



Sharing buttons:

hello friends in this video I will show

you how to fetch data from two or more

related table with join using PHP and my

SQL suppose friends if you want to get

data from two table on the same page

then you want to use my SQL inner join

query the inner join keyword selects all

rows from both tables as long as there

is a match between the columns in both

tables and we can easily fetch data and

display on page

French I have two table with name brand

and product in brand table there is two

column branded and brand name branded is

a primary key in product table there is

three column product in product name and

brand in here product it is primary key

and branded is a foreign key of product

table friends I have already inserted

some data into this both table brand and

product

friends this is my simple page in this I

have used bootstrap CSS framework

now friends I have right one-variable

Connect for database connection string

and make database connection by using

this click connect function with 4

parameter like host equal to locale lost

username equal to root password equal to

blank and database equal to triple z

friends after making database connection

I have write new variable SQL and in

this variable I have store asked ul

query for joining two table friends I

have used in a joint to join two table

and write SQL query like select star

from Brandon a joint product on brand

branded equal to product dot branded

with the help of this query this two

table will be joined that match between

the columns in both tables

you

friends after i test you i'll query to

join two table now i want to execute

this query for this i have defined one

variable result and in this variable I

will store result of executed SQL query

I have used mystically query function to

execute SQL query

friends first i defined table to column

name like first column name brand name

and second column name like product name

you

friends after execute SQL and get result

now I want to check result has Rho is

greater than zero for this I have used

miss clean am rose function with help of

this function I can get number of rows

and check number of rows is greater than

zero or not

you

if number of rows is greater than zero

then after I have used while loop with

mystically fetch array function and this

function fetch as a result row as an

associative array a numeric array or

both and store into one new variable

Rome

now friends I simply print data into

table column for print first column data

I have rights open and close table data

and between this I write PHP syntax and

write echo statement with row variable

with table column name brand name and

for second column data I have write open

and close table data and between this I

write PHP syntax and write echo

statement with row variable with table

column name product name

now friends check out what in browser

friends you can see that brand name

theta comes from brand table and product

name theta comes from product table by

using table inner join query I have

fetched two table data which are common

in both table in both table branded data

is common in both table so friends thank

you for watching this video if you have

any query regarding this video you can

comment on this video I will reply on

your comment friends you want to get

more update of my video so friends you

can subscribe my youtube channel friends

you can also like my Facebook page also

or you can also follow webs listen on

Twitter