I'm trying to upload three images and few texts related to car using PHP and MYSQL. Initially the i got the message " MYSQL has gone away.." so I increased the max_packet size to 500M . .The database name, table name are correct.
Following is the php code I have used.
<?php
        if(isset($_POST["submit"])) 
        {
                $check1 = getimagesize($_FILES["image1"]["tmp_name"]);
                $check2 = getimagesize($_FILES["image2"]["tmp_name"]);
                $check3 = getimagesize($_FILES["image3"]["tmp_name"]);
                if($check1 !== false and $check2 !== false and $check3 !== false)    
                {        
                    $img1 = $_FILES['image1']['tmp_name'];
                    $imgContent1 = addslashes(file_get_contents($img1));
                    $frontimg = $imgContent1;
                    $img2 = $_FILES['image2']['tmp_name'];
                    $imgContent2 = addslashes(file_get_contents($img2));
                    $backimg = $imgContent2;
                    $img3 = $_FILES['image3']['tmp_name'];
                    $imgContent3 = addslashes(file_get_contents($img3));
                    $intimg = $imgContent3;
                    $kms      = htmlentities($_POST["kms"]);
                    $make     = htmlentities($_POST["make"]);
                    $model = htmlentities($_POST["model"]);
                    $variant = htmlentities($_POST["variant"]);
                    $reg = htmlentities($_POST["year"]);
                    $color = htmlentities($_POST["color"]);
                    $owner = htmlentities($_POST["owner"]);
                    $price = htmlentities($_POST["price"]);
                    $dbHost     = 'localhost';
                    $dbUsername = 'root';
                    $dbPassword = '';
                    $dbName     = 'car';
                    $db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
                    // Check connection
                    if($db->connect_error)
                    {
                        die("Connection failed: " . $db->connect_error);
                    }
                    $insert = $db->query("  insert into car( frontimg, backimg, intimg, kms, make, model, variant, reg, color, owner, price ) 
                                                       values ('$frontimg', '$backimg', '$intimg','$kms','$make', '$model', '$variant', '$reg', '$color', 
                                                       '$owner','$price')  ");   
                    if($insert)
                    {
                             echo "data stored successfully";
                    }
                    else
                    {
                        echo "Check your query";
                    }   
                } 
            }
?>
The php is returning the text " Check your query " indicating the error in the SQL code. What might have gone wrong here..
