Search the Community
Showing results for tags 'int'.
-
Why cannot I enter more than 127 items as quantity in the cart. I have tried and changed quantity in carts table from tinyint to smallint and that does not help. The maximum quantity of one item that can be selected is 127.
-
In the following code, (I know the if statement isn't complete, I am referring to the part before it) I am unclear why (int) is used, after using php for over a year I have never really understood when I should use (int). Is it to make sure the returned number is changed from a decimal to an integer?? Please explain why it is used in this block of code. It is from chapter 6 in the ipn.php script. if (mysqli_num_rows($r) === 0){ $uid = (isset($_POST['custom'])) ? (int) $_POST['custom'] : 0; $status = escape_data($_POST['payment_status'], $dbc); $amount = (int) ($_POST['mc_gross'] * 100); $q = "INSERT INTO orders (user_id, transaction_id, payment_status, payment_amount) VALUES ($uid, '$txn_id', '$status', $amount)"; $r = mysqli_query($dbc, $q); if (mysqli_affected_rows($dbc) === 1){ } }