Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hey... that was the best title I could come up with!
I have a script that uses a certain field to look for a file name on a server.
If the field reads: Cats
it looks for Cats.php
If the field reads: Cats and Dogs
it looks for Cats and Dogs.php
This all works like a charm and I love it.
Here's the question.
If the field reads: 3" Wide Boxes
I can't make the file called 3" Wide Boxes because it won't let me on account of the quote. Is there a way around this?
Here's the code that looks for the file based on the field:Code: Select all
<tr>
<td>
<?php
$category_tacm= tep_db_query("select cd.categories_name from " .
TABLE_CATEGORIES_DESCRIPTION . " cd where cd.categories_id = '" .
(int)$current_category_id . "' and cd.scat_id = '" .
(int)$anal_id . "'");
$category = tep_db_fetch_array($category_query);
$****er=
'includes/descriptions/'.$category['categories_name'].'.php';
if (file_exists($filename)) { include( $filename );
} ?>
<?php include(DIR_WS_MODULES . FILENAME_PUD_LISTING);
?>
</td>
</tr>Yes... and description is inserted here:
$category['categories_name']
so it looks for a file names, for exaple
3" Wide Boxes and it can't find it because I wasn't able to save a file called 3" Wide Boxes... if there was a way to substitute an accepted character (or omit it) whenever it runs into an unaccepted character that would work.
So when it gets a description of:
3" Wide Boxes it would look for 3 Wide Boxes
That *would* work.
I know I'm on the right path...
I already tried to just make the field name: 3\" Wide Boxes and since the field is updated via html to mySql it takes the \ out... or at least... it just doesn't work.
I'm thinking I'm on to something but just don't know how to do it.
Thanks!!!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]