User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 423,293 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,295 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 1603 | Replies: 3
Reply
Join Date: Jan 2008
Posts: 3
Reputation: sanscls is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sanscls sanscls is offline Offline
Newbie Poster

I'm sure there is an easy Loop solution - doing an update

  #1  
Apr 1st, 2008
I want to update an access db with multiple records. They are property pictures. They may have the same listnumber, but all have a different ID#. There are not always a set amount of pics... may be 5 or 7 or 10, etc..

The DB fields are id, filedata (actual .jpg filename), picturename, listnumber

I am trying to add names to all pictures at once instead of one at a time. Below is the code I have... it is only updating one record at a time.

Data entry page: (output query: lookup grabs the pictures witha a specific listnumber ie:1950)

  1. <cfoutput query="lookup">
  2. <form enctype="multipart/form-data" action="title_picture_action.cfm?id=#listnumber#" method="POST">
  3. <input type="hidden" name="id" value="#id#">
  4. <input type="hidden" name="listnumber" value="#listnumber#">
  5.  
  6. <table border="0" width="500" cellpadding="10" cellspacing="0">
  7. <tr>
  8. <td><img src="images/uploads/#filedata#" width="100"></td>
  9. <td><input type="text" maxlength="50" size="20" name="picturename" value="#picturename#"></td>
  10. <!--- <td align="center">
  11. <input type="submit" value="Submit"></td> --->
  12.  
  13. <hr color="00704a" style="height = 1px">
  14. </tr>
  15. </cfoutput>
  16. <tr><td><input type="submit" value="Submit"></form></td></tr>
  17. <table>

Processing page:

  1. <cfquery name="titlepicture" datasource="#dsn#">
  2. UPDATE uploads SET
  3. picturename = '#form.picturename#'
  4. WHERE id = #form.id#
  5. </cfquery>
  6.  
  7. <cflocation url="index.cfm

Any help will be GREATLY appreciated! Thx in advance.
Last edited by peter_budo : Apr 4th, 2008 at 4:25 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Posts: 3
Reputation: sanscls is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sanscls sanscls is offline Offline
Newbie Poster

Re: I'm sure there is an easy Loop solution - doing an update

  #2  
Apr 2nd, 2008
To make clear: My problem is on the Processing page. I need to be able to update MULTIPLE images (filedatd field in db) with names (picturename field in db) They will have the SAME listnumber, but different ID numbers.
Reply With Quote  
Join Date: Jul 2007
Posts: 13
Reputation: tashakota is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
tashakota tashakota is offline Offline
Newbie Poster

Re: I'm sure there is an easy Loop solution - doing an update

  #3  
Apr 15th, 2008
Originally Posted by sanscls View Post
To make clear: My problem is on the Processing page. I need to be able to update MULTIPLE images (filedatd field in db) with names (picturename field in db) They will have the SAME listnumber, but different ID numbers.


I believe if you update the db using the listnumber instead of the id, then you should be updating all records with that listnumber.

ie:

  1. cfquery name="titlepicture" datasource="#dsn#"
  2. UPDATE uploads SET
  3. picturename = '#form.picturename#'
  4. WHERE listnumber = #form.listnumber#
  5. cfquery
  6.  
  7. cflocation url="index.cfm
Last edited by peter_budo : Apr 20th, 2008 at 6:51 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
Join Date: Jun 2008
Location: Dhaka
Posts: 10
Reputation: iqbalhosan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
iqbalhosan iqbalhosan is offline Offline
Newbie Poster

try this!

  #4  
Jun 3rd, 2008
  1. <cfoutput>
  2. <form enctype="multipart/form-data" action="title_picture_action.cfm?id=#listnumber#" method="POST">
  3. <table border="0" width="500" cellpadding="10" cellspacing="0">
  4. <tr>
  5. <td><img src="images/uploads/#filedata#" width="100"></td>
  6. <td>
  7. <input type="text" maxlength="50" size="20" name="picturename" value="#picturename#">
  8. <input type="submit" value="Submit">
  9. </td>
  10. </tr>
  11. </table>
  12. </form>
  13. </cfoutput>





###################processing page################


  1. <cfquery name="titlepicture" datasource="#dsn#">
  2. UPDATE uploads
  3. SET picturename = '#form.picturename#'
  4. WHERE id = #url.id#
  5. </cfquery>
Last edited by peter_budo : Jun 4th, 2008 at 3:30 am. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ColdFusion Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 10:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC