Q:

Mysql PHP insert query not working properly

I have made a script that inserts some information in a mysql database. Whatever value I enter inn the prod_id field, '2147483647' gets inserted in that field. Data is being inserted correctly in all the other fields. Please suggest what may be causing his error?
Here is the concerned code:
<form method="post" name="new_prod" action="new_prod.php">
                <div class="form-group">
                    <input type="text" name="prod_id" class="form-control" placeholder="Enter Product ID" >
                </div>
                <div class="form-group">
                    <input type="text" name="prod_name" class="form-control" placeholder="Enter Product Details" >
                </div>
                <div class="form-group">
                    <input type="text" name="prod_price" class="form-control" placeholder="Enter Product price" >   
                </div>
                <button type="submit" class="btn btn-default" name="sub">Add Product</button>   
            </form>
        </div>
    </div>
</body>
</html>
<?php
$link=mysqli_connect("localhost","root","","smartcart");
if(isset($_POST['sub']))
{
    $prod_id=$_POST['prod_id'];
    $prod_name=$_POST['prod_name'];
    $prod_price=$_POST['prod_price'];
    $a="INSERT into products (prod_id, prod_name, prod_price) VALUES ('$prod_id', '$prod_name', '$prod_price')";
    if (mysqli_query($link,$a))
        {
            echo "Product successfully added to the database";
        }
    else
    {
        $error=mysqli_error($link);
        echo "Product addition failed. Please contact the developer if problem persists.".$error;
    }   
    mysqli_close($link);
}

A:

2147483647 is the largest value for the integer in mysql. Just change the type of the prod_id from int to bigint.

