I have existing code that uploads files, creates new names for them, and inserts those file names into a table (No, I didn’t write all of this myself, I had help...).
The file naming convention consists of the ID from the PORC_records table, the species name and a number (named $i) added to the end of each filename incrementally (1, 2, 3, etc.).
I now want to modify this code in order to upload additional files after the initial upload. So I need to get the new starting point for $i.
I assume the easiest way is to run a query that counts the number of records for this ID (in the sample above : 11) and adds one to that total. In the sample above the new starting $i would be 4.
$rsImagesCount = new WA_MySQLi_RS("rsImagesCount",$siteguide2018,1);
$rsImagesCount->setQuery("SELECT * FROM PORC_Media WHERE record_ID = ? and file_type = ‘I’ ");
$rsImagesCount->bindParam("i", "".($_GET['record_ID']) ."", "-1"); //colname
I have inserted the relevant code into the attached page (PORC_edit_media.php).
There are three sections. Images, Audio, Video.
Can you show me the code to do this for just one section (I will do the others)?
Is line 49 correctly coded?
Line 82 is where $i first appears
Also, I only want each section to run if a file has been selected to upload.