close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Inserting records

Thread began 1/13/2022 6:52 am by birdscreen398247 | Last modified 1/13/2022 9:35 am by birdscreen398247 | 110 views | 1 replies

birdscreen398247

Inserting records

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.).

11-DarkeyedOregonJunco-1.JPG
11-DarkeyedOregonJunco-2.JPG
11-DarkeyedOregonJunco-3.JPG

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.


<?php
$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
$rsImagesCount->execute();
?>


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.

Attached Files
PORC_edit_media.php

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...