Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop? Question

Status
Not open for further replies.

jarla

Programmer
Jan 2, 2001
34
FI
A new problem again. I have a page where my customer can download pictures with his (or her) username. I´ve wrote a cfm -page which handles database connection. It writes down username, date and the picturename(s). If the user downloads more than one picture, how can I add every of them on different database line? Now my program adds every picturename to the same column. Example:

Date Pictures Username
02-14-2001 pic1,pic2,pic3 user
---------------------------------------------
I want it like this:
Date
02-14-2001 Pictures Username
pic1 user
pic2
pic3
---------------------------------------------
Thank you!
 
instead of a &quot;,&quot; append a &quot;<br>&quot; ??
or if ot's more of a sql problem, insert 3 times instead of 1 ...
 
Here is my code, which inserts picturenames to database:

<cfquery datasource=&quot;datasourcename&quot; name=&quot;insert&quot;>
INSERT INTO downloads (date, picture, username)
VALUES (#Now()# , '#form.picturename#', '#form.username#')
</cfquery>

Is that right and how must I change it that it puts every picturename to different column like I told on my first message?
 
your query looks good, with it you'll get :

Date Picture Username
02-14-2001 pic1 user
02-14-2001 pic2 user
02-14-2001 pic3 user

(if you repeat it 3 times, changing only the picture name)

sounds like it's what you waned to have, right ?
 
Is your picture a jpg/gif file?? How do you move the image into the database?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top