Name,comment and images not in same row

Un

titled

So you’ve messed up your inserts somewhere. Inserting the image separately from the other fields.

$db = mysqli_connect("localhost", "root", "", "");

// Initialize message variable
$msg = "";

if (isset($_POST['send'])) {

  $images = $_FILES['images']['name'];

  $target = "images/".basename($images);

  $sql = "INSERT INTO blog1 (images) "
          . "VALUES ('$images')";

  mysqli_query($db, $sql);


  if (move_uploaded_file($_FILES['images']['tmp_name'], $target)) {
      $msg = "Image uploaded successfully";
  }else{
      $msg = "Failed to upload image";
  }
}

$result = mysqli_query($db, "SELECT * FROM images");

from here

… is the intention to have multiple files for a user, or a single one? How exactly does one associate which user to tie the picture to?

multiple files

does not associate user to tie the picture to?

I fixed.:sunglasses:i am good.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.