Jonathan Rosenbaum
10 years ago
4 changed files with 51 additions and 2 deletions
@ -0,0 +1,20 @@ |
|||||
|
/* jQuery fun with transactions - Jonathan Rosenbaum */ |
||||
|
|
||||
|
// currently css is just hardwired, but that reflects the coding style of YBDB :)
|
||||
|
|
||||
|
$(function() { |
||||
|
|
||||
|
$(".paid").click(function() { |
||||
|
if ($(this).prop("checked")) { |
||||
|
//console.log("turn color on");
|
||||
|
$(this).closest("tr").css("background-color","#99CC33"); |
||||
|
$.post("json/transaction.php",{ paid: 1, transaction_id: this.name } ); |
||||
|
} |
||||
|
else { |
||||
|
//console.log("turn color off");
|
||||
|
$(this).closest("tr").css("background-color","transparent"); |
||||
|
$.post("json/transaction.php",{ paid: 0, transaction_id: this.name } ); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,21 @@ |
|||||
|
<?php |
||||
|
|
||||
|
require_once('../Connections/YBDB.php'); |
||||
|
mysql_select_db($database_YBDB, $YBDB); |
||||
|
|
||||
|
|
||||
|
if(isset($_POST['paid'])) { |
||||
|
if ($_POST['paid'] == 1) { |
||||
|
|
||||
|
$query = "UPDATE transaction_log SET paid=1 WHERE transaction_id=" . $_POST['transaction_id'] . ";"; |
||||
|
$result = mysql_query($query, $YBDB) or die(mysql_error()); |
||||
|
|
||||
|
} elseif($_POST['paid'] == 0) { |
||||
|
|
||||
|
$query = "UPDATE transaction_log SET paid=0 WHERE transaction_id=" . $_POST['transaction_id'] . ";"; |
||||
|
$result = mysql_query($query, $YBDB) or die(mysql_error()); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
?> |
Loading…
Reference in new issue