htmanning has asked for the wisdom of the Perl Monks concerning the following question:
@words = split (/ /, $base_title); $filename = $dateadded."-" . join("-",@words) . ".html"; $filename_base = $filename; $filename_base =~ s/\.html//g; # check to see if filename is being used $SQL = "SELECT * FROM $database_table WHERE filename = '$filename' +"; &Do_SQL; $i=2; while ($pointer = $sth->fetchrow_hashref){ $filename = $filename_base."$i.html"; $i++; $SQL = "SELECT * FROM $database_table filename = '$filename'"; &Do_SQL; } $SQL = "INSERT INTO $database_table (filename) VALUES ('fi +lename')"; &Do_SQL;
Any help would be appreciated. It might be simple, but I'm stumped. Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Avoiding duplicate filenames
by Corion (Patriarch) on Sep 25, 2018 at 20:14 UTC | |
|
Re: Avoiding duplicate filenames
by afoken (Chancellor) on Sep 25, 2018 at 22:37 UTC | |
by htmanning (Friar) on Sep 25, 2018 at 23:38 UTC | |
|
Re: Avoiding duplicate filenames
by poj (Abbot) on Sep 25, 2018 at 20:26 UTC | |
|
Re: Avoiding duplicate filenames
by Marshall (Canon) on Sep 25, 2018 at 20:15 UTC | |
by hippo (Archbishop) on Sep 25, 2018 at 21:44 UTC | |
by Marshall (Canon) on Sep 26, 2018 at 01:32 UTC |