Help with trying to add VALUE to a COLUMN

I’m trying to get the ‘newfilename’ to appear in the videos table with the uploaded video, video title and video description.

In the video upload Form the User first uploads an image with this code:

if ($form_submitted == 'yes') {
    $allowedExts = array("gif", "jpeg", "jpg", "png");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = strtolower( end($temp) ); // in case user named file ".JPG" etc.!!!
    if (  $_FILES["file"]["size"] < 2000000
          && in_array($extension, $allowedExts) )
        if ($_FILES["file"]["error"]!= 0)
            echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
        } else {
            $length = 20;
            $randomString = substr(str_shuffle(md5(time())),0,$length);
            $newfilename = $randomString . "." . $extension;
            move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newfilename );
            $sql = "INSERT INTO videos ( thumbnail ) VALUES ( '$newfilename' )"; 
           $file_location = '<a href="' . $newfilename . '">' . $newfilename . '</a>';
    } else {
      echo "Invalid upload file";
    $description = $description . " \n " . $newfilename;

And then finishes the upload video Form by uploading the video.
That code (above) succeeds in added the data to the ‘thumbnail’ column, but it’s in its own row, the rest of the upload info video, title, description, etc. is in its own row.

I tried replacing it with this:

    $sql = "UPDATE videos SET thumbnail='".$newfilename."' WHERE rowID = '".$user_id."'";

But that didn’t succeed.
Any additional help will be appreciated.

I think “rowID” is a reserved internally generated identifier in MySQL that isn’t necessarily the same as the value in your auto-increment column.

Also, this should suffice to create a unique filename:

$newfilename = md5_file($path_to_file) . "." . $extension;

Standard Discllaimer: The mysql_ library is deprecated. Please consider upgrading to mysqli_ or PDO.

Neither RowID or Thumbnail are reserved words in MySQL 5.7.

@ChrisjChrisj : When you say ‘didnt succeed’… did you test the return of the query? Did it throw an error ([FPHP]mysql_error[/FPHP])?My immediate suspicion is that rowID is an INT field, but you’re string-encapsulating it.