您可以在插入数据时对变量求和或添加吗?

I would like to ask if it is possible to add together with a variable, I've manage it to echo it and it worked.

But is it possible in a insert statement?

Here is my code!

<?php 
include('admin/db/database_configuration.php');
$sql = "SELECT * FROM tblalbums";
   $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        // output data of each row
       $row = $result->fetch_assoc();
       $wow = $row['album_id'];
    echo ($row['album_id']+1);
} else {
    echo "0 results";
}
$conn->close();
?>

<?php
include('admin/db/database_configuration.php');
if (isset($_FILES["userfile"]) && !empty($_FILES["userfile"])) {
    $image = $_FILES['userfile']['tmp_name'];

    $imageSize = $_FILES['userfile']['size'];
    $imageType = $_FILES['userfile']['type'];
    // $job_desc = $_POST['desc'];
    $imageName = $_FILES['userfile']['name'];

    $len = count($image);
    $path = "jobs/";
    for ($i = 0; $i < $len; $i++) {
         if (isset($imageName[$i]) && $imageName[$i] !== NULL) {
             if(move_uploaded_file($image[$i], $path.$imageName[$i])) {
                // $result = $conn->query("INSERT INTO tbljoba ( job_img_size, job_img_type, job_desc, job_img) VALUES ('$imageSize[$i]', '$imageType[$i]', '$job_desc', '$imageName[$i]')");
                $sql = "INSERT INTO `tblphotos` ( imageName, imageSize, imageType, album_id) VALUES ('$imageName[$i]','$imageSize[$i]', '$imageType[$i]', '$wow');";
                // echo"<script>alert('Image upload successfully!');location.href='employer_contact_us.php';</script>";

                 if ($conn->query($sql) === TRUE) {
                    echo "New records created successfully";
                } else {
                    echo "Error: " . $sql . "<br>" . $conn->error;
                }
            }
         }
    }
}
$conn->close();

?>

As you can see above the variable $wow is album_id in the database, and i've echo it so the last number in the database + 1.

So i've got the INSERT statement and you can see there I've put the variable $wow. So how can add or sum up + 1 in adding values?

Thank you!

remove single quoted lines ' ' from $wow in VALUES then +1 $wow=1 without single quoted lines so that it will not read as a string to the database

You can find and read information about AUTO_INCREMENT for fields in MySQL

May be this can help you.