와 수학을하는 데 도움이 필요 나는이 다음 JQuery와/자바 스크립트는 PHP와 자바 스크립트
<script>
var Quantity;
$("select").change(function() {
var str = "";
var price = <?php echo $row[price];?>;
$("select option:selected").each(function() {
str += $(this).text() + " ";
});
$(".plan_price").text("price : " + parseInt(str) * price + " baht");
Quantity = parseInt(str);
}).change();
</script>
이 PHP/SQL에 대한
if ($row[item_amount] - 1 == 0) {
$sql = "update item set active='2',item_amount=item_amount-1,buy_time=NOW() where id='$id'";
} else {
$sql = "update item set item_amount=item_amount-1,buy_time=NOW() where id='$id'";
}
나는 나를 위해 어떤 방법이 있는지 알고 싶어요 PHP에서 $ row [item_amount]와 자바 스크립트 변수 Quantity의 값을 뺄셈/더하기 위해 Quantity를 데이터베이스에서 뺄 필요가 있습니다.
_note : 자바 스크립트를 PHP에 포함시킬 수 있지만 javascipt_ –
안에 PHP를 포함 할 수 없습니다. 그게 무슨 뜻입니까? – vodich
단순히 PHP 변수 값을 javascript 변수에 할당 할 수 있다는 것을 의미하지만 반대의 경우는 가능하지 않습니다. –