0
Create a like button with php mysql ?
I want to make a like button with php..i am simply doing this by : <?php if($_POST['like']) { $sql = "UPDATE post set `likes` = `likes`+1 where `product_id` = '1'"; $result=mysql_query($sql); } ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST"> <input type = "submit" value = "like" name='like'/> </form> i want to make it like facebook like button so when i click on it on the button refreshes itself not the entire page.
3 odpowiedzi
+ 2
You should read about AJAX, which is Asynchronous JavaScript and XML. Using this technology, you can actually dynamically change the content of the current page without refreshing it.
Sadly, PHP is a server-sided language, so you can't do that with PHP alone.
+ 1
done it..thnx @Freezemage
+ 1
need one more help call you tell me the database structure for each post's likes and comments....its little bit confusing me