I want to generete a index of all image files in a folder and save this to mysql column "picID":
Get Files with scandir:
$images = scandir("./", 1);
// print_r($images);
Send Array to MySQL
(into Column "picID") - but How?
In the End it should be sg. like this:
| id | picID | A N D N O T : | id | picID |
|----|------------| |----|--------------------------|
| 1 | DSC237.jpg | | 1 | DSC237.jpg, DSC947.jpg |
| 2 | DSC947.jpg | | .. | .. |
Solution: I modified Patricks answer to achieve my goal:
$link = mysqli_connect("host", "user", "pass", "db") or die(mysqli_error($link));
$images = "('" . implode( scandir("./", 1), "'),('") . "')";
// Result is: ('a'),('b'),('c') -> VALUES ('a'),('b'),('c')
mysqli_query($link, "INSERT INTO `tablename` (picID) VALUES $images");