Forums

PHP

This topic is locked

help - check for file, if/else statement(?)

Posted 28 Feb 2007 21:56:44
1
has voted
28 Feb 2007 21:56:44 Chad Lenek posted:
Hi,

I'm fairly new to php, databases, etc, but have been tasked with managing a company website that is transitioning from a static site to database-driven. What we're trying to do is add some of our own content to copy of an existing database site created by People Who Know More -our head company.

I'd like to add a piece of code on a product details page that checks to see if a <product number>.pdf file exists within a /pdf folder. If the file exists, then show an image button linked to the pdf file, if it doesn't exist then show nothing.

One thing I'm unsure of is how much this needs to interact with our database - the product_details page is db driven, and accessed by menu links which specify <a href="product_detail.php?Prod=XXXX">. I had hoped to be able to perform this function without altering the database - as the database itself is managed by our head company; they would need to perform any changes and might complicate usage of the db by the company's various international branches.

I've been doing some searching online but haven't found anything that's quite what I need - if anyone can offer any help or point me in the right direction that would be greatly appreciated!

Thanks very much,
Chad

Replies

Replied 01 Mar 2007 17:18:09
01 Mar 2007 17:18:09 Alan C replied:
Hi

ca.php.net/manual/en/function.unlink.php

there's an example at the bottom of the page that deletes/replaces so I guess that somewhere in the code is a way to get a listing of all the files, that should be modifyable.

Hope that's some help

Reply to this topic