I have a folder/array of images, it may be 1, maximum of 12. What I need to do is dynamically add them so the images are added to an images table.
At the moment I have
$directory = "portfolio_images/$id/Thumbs/";
$images = glob("" . $directory . "*.jpg");
for ( $i= 0; $i <= count($images); $i += 1) {
mysql_query("INSERT INTO project_images (image_name, project_id)VALUES ('$images[0]', '$id')") or die(mysql_error());
}
this is fine but it does not feel right, how is this for performance? Is there a better way?
The maximum number of images is only ever going to be 12.