Fetching / Extraction of Data From Database Without Refreshing Webpage: jQuery + PHP + MySQL
http://technotip.com/2298/fetchextract-data-from-database-without-refreshing-webpage-jquery/
In this tutorial we'll be showing you, how to extract the data present in our MySQL database table without refreshing the webpage.
jQuery Video Tutorial List:
http://technotip.com/2514/jquery-tutorial-list/
Closed Caption:
well let's see how to extract of fetch
data from my skill database without
actually refreshing the page basically
we use jQuery in the video to fetch the
data from database and some PHP
performance the mysql data into JSON
object or person important having heard
my prepare customs trip but we're in
right jquery script now connecting with
the database is still under school
connect is a standard PHP function to
connect to your server server name is
localhost username is who and we don't
have any possible by living blank next
and selected database there have been
many databases in or my school console
so we need to select the one on which
you be working and selected degrees
let me call it does something ok let's
see how come actually create this
database and say this fine as AV dot PHP
now let's open PHP my admin from our
local host and then create a database
for company so we have this for company
inside that I create a table or in for
which will help to phil's name and age
let me make this very building company
and install let me make this table name
as people
because we help people information name
age and company page and the company
which this person world's course name
and company will be back page individual
so this so we have company database
inside we have a table called people the
creeps main page and company
let's connect this PHP file to the
database come before that let me add
some data into the table that is people
people table insert into people people
is the name of the table values we have
three please name the name and age and
then company in name is my ages 25 and I
work for the company that note it go
so one day one ball has been inserted
now insert another level here on 28
works at a record
let's do it once more
so now we have that this company inside
that table people inside that we have
three records name age company of the
field for table include ones connect to
the database that it's company we
created just now
so once we connect to your database
let's vary your table that is our table
name is people select start from people
which means all the page name age and
company will be etched once we execute
is very that is still statement select
start from people so this execute our
free autocheck work to do if education
pays for those tutorials please with the
technology com and the ph picture of
Kevin so we helped a variable called
result which is an RA we don't have any
other elements it look through this
result and then store these values
inside the variable result we have
underscored push let's see or other
where functions we have are they all for
ok we'll do our apush that is we insert
values inside this variable variable
result first parameter is starting name
next store the values that is stretching
from the database with key value format
that is the pairing of key and value so
he is named such the name from the
database will be ro 0 assign it to the
name
now aged is the key assigned the actual
page isn't inside the database this
eighth will be present in central one
company for me present inside walls to
remember index starts from zero company
is the key
its value is being protected from the
database and with the president of food
so all these things are pushed into the
variable results now and for this
edition foam so Jason school and cold is
a standard PHP function with imports
Jason Foreman so ra first parameter is
named next is the variable that is all
the values present inside that are
available now stored this save this fine
remember this fine lame French doctor HP
let's see how the output looks like our
final and his fetch dot PHP so this is
our Jason and Lauren Baker which is
being affected from our database company
so we have our Airport result this is
the name result the key
it's an RA it has three objects which
was present inside our database if you
remember let me show you th 25
technically it's the first object now
the second object children 28 oracle
this is the second object and the third
one
so the mysql data is being affectionate
and then and ported into Jason former
which is stored as an RA inside with the
key of result not let me fetch this data
and displayed on our index dot PHP with
the help of jQuery so here goes over
this with jquery great once the document
is loaded and then and ready all
anonymous function and then the shortcut
of Ajax method of jQuery dollar Dog get
Jason first parameter is the filing to
be passed in our in this French thought
it'd be
we have just seen the output of this
fine which would be returned to this
callback function let me show you once
again this is the output which is being
passed to the callback function so this
is the final being passed and this is
the better everyone this all that
function we catch it give it a name for
data and then process this information
that is data if the unordered list has
something in it just empty it out
interesting is to avoid duplication next
loop through all these objects objects
one object or the 1and1 remember index
and starts from zero here so this data
is the first parameter and the are a
variable are a key in that is results
they are not result is the first
parameter second parameter is the
callback function now select the
unordered list and then find the list
items which we are going to change from
this bitch . creative fine plus is the
concatenation operator also please visit
the video of about how to fetch array
elements jquery that is our element of
Jason so there is a need for name all
the objects so this of name which all
the names present in each objects
let's and the aging permission to do
okay electronic age and company
information to everything i'll change
the label and the index it acts just
like an associative array here
that's it
this should fetch all the data from each
dot PHP and then appended to the
unordered list of index . PhD so all
these have name age and company they
have expected all these data using or
temporary knowledge now let's see on the
browser remove this and end
ok it has such information successfully
from our database
all three persons information now let's
objectify this process i write a custom
function and inside that and call it
updates and fish this here now we
already know set time of function which
takes two parameters the second on being
the delayed time the first one being an
anonymous function inside which we
recall some functions that is some
custom function well and also we need to
call set time of itself because it needs
to call itself repeatedly so I just talk
this out and then okay I'll just take
out this information that is that time
out practice and then make a separate
function good call it on some done this
if you remove this call
let me arrange it and then all itself
cannot all done once the document is
ready so this shirt successfully Jack
safai your application that is the date
is being threatened from the database
about the webpage being reloaded so all
the dough and well then let me assure
that so i add a new entry
and that should be updated immediately
on our webpage inserting the people
values name age and then company in once
i hit Robin it should get updated here
without refreshing
ok operated without the webpage being
really select see some years I i'll just
get the information of hidden and it
should reflect on the web page
immediately once i hit OK they should be
removed
ok children in from healthcare and being
removed now I'll remove the information
of Roku and just delete it and if you go
from webpage to finally let me show you
the Attic operation and let it my
information change the company to
Microsoft once I hate bow it should
update on my webpage to this information
updated immediately so this is how we
objectify our application and fetch data
from our database the top refreshing for
reloading the webpage hope this helps
for PHP tutorials please visit
technology platform and PHP category
please share this video with your
friends on Facebook Linkedin Google+
Twitter access please subscribe to our
blog technology com and you plannin also
if this video helped you in any small
day please don't we don't forget to like
this video on youtube
Video Length: 16:57
Uploaded By: Satish B
View Count: 59,902