update page contents from mysql data without reloading

Codes here !

Moderators: macek, egami, gesf

Post Reply
User avatar
macek
php-forum Active User
php-forum Active User
Posts: 277
Joined: Wed Aug 25, 2010 10:42 am
Contact:

Re: update page contents from mysql data without reloading

Post by macek » Mon May 21, 2012 10:51 am

It is possible. I reccomend to use jQuery ,..

Novica89
New php-forum User
New php-forum User
Posts: 7
Joined: Fri May 18, 2012 5:34 am

Re: update page contents from mysql data without reloading

Post by Novica89 » Tue May 22, 2012 4:20 am

You need a jQuery file which will use,let's say

$.post ( name_of_the_php_file_where_to_send_data.php,{ variable_name_you_are_sending_to_that_php_file : variable_which_value_it_gets, var2 : value2, var3:value3 },function (data) {
alert (data); //gets the data outputed in the php file and alerts it,just a sample
return false; // if you are querying once some link is clicked,this will assure that you don't redirect to wherever href of that link leads to
);

You don't have to do anything with callback function if you don't want to.

then in the .php file you are sending those variables to,use code similar to this:

if (isset($_POST['variable_name_you_are_sending_to_that_php_file'])) {
$value = $_POST['variable_name_you_are_sending_to_that_php_file'];
if(!empty($value){
$query = "DO SOME MYSQL QUERYING HERE";
$run_query = mysql_query($query);
}
}

More on this (with some examples), http://docs.jquery.com/Post

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest