how to add data ( name, message etc) and 3 images path into DB (images in folder


#1

how to add data ( name, message etc) and 3 images path into DB (images in folder)
because its impossible to add 3 images into DB with phone number name, message etc ??


#2

Create a table for the images.

[php]create table Image (
id int auto_increment primary_key,
member_id not null,
file_path varchar(256) not null,
dateAdded timestamp default CURRENT_TIMESTAMP,
FOREIGN KEY (member_id) REFERENCES Member(id) ON DELETE CASCADE ON UPDATE CASCASE
) engine=InnoDB;[/php]


#3

I have but I need a table or 2 tables for name, message, phone, email and 3 images ( like adding adverts) I know how to add all info into DB, but I have no idea how to add 3 images with this informations


#4

You don’t need, and actually don’t want, the same data duplicated everywhere.

Using the table i created, you would pull the images from the database based on the user id provided.


#5

do I need columns for image type and image tmp_name??


#6

tmp_name, no. Type, depends how you use it. Otherwise, let the system determine how it wants to deal with it.

A system I built stored the original file name, but that wasn’t the filename it used in the directory. When displaying it to the user, it would show the original name it had when it was uploaded.


#7

Thank you so much I will try do add it and we will see if its gonna work