Saving a value and incrementing it using jquery

Saving a value and incrementing it using jquery

Hi All,

I am making a LOVE IT button using php and jquery and i have most of it working...

The button currently returns the value from the DB of 0 but when i click the button it wont save the incremented value to the DB.

Please see it here  http://bit.ly/dKx15z 

my code is this

  1. <?php
  2. mysql_connect("localhost", "web183-loveit", "password") or die ("Error.");
  3. mysql_select_db("web183-loveit") or die ("error");

  4. $increase = "UPDATE results SET value=value+1 WHERE id=1;";
  5. $active_rate = mysql_query("SELECT * FROM results WHERE id=1;");
  6. $val = 0;

  7. if($rt = mysql_fetch_assoc($active_rate)) {
  8. $val = $rt['value'];
  9. }

  10. if($_POST['action'] == 'add') {
  11. mysql_query($increase);
  12. print $val++;
  13. }
  14. ?>