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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to the same row 1

Status
Not open for further replies.
Apr 2, 2003
58
GB
I have a PHP script which has loop that writes the file names of a directory into my database. (I have paraphrased the script into english so as to not get bogged down with PHP syntax)

Either of the filesnames start with an a or a b. There are identical apart from the prefix letter (a or b!)

My script says:

does this filename begin with an "a"

if so INSERT it into this database column.

else

does this filename begin with a "b"

if so INSERT it into this column.

etc.

The problem is, say if there are two filenames beginning with "a" and two filenames beginning with "b"

the first two "a" filenames are entered into rows 1 and 2. And the "b" filenames are entered into rows 3 and 4.

My question is how can I avoid this and how can I get them to be entered into the same rows Whilst keeping the if and else structure.




 
If you insert every time, you will create more rows.

You need to insert the first time, then update the row from that time on.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top