What php code can support image?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
teckyan888
Forum Commoner
Posts: 40
Joined: Tue May 11, 2004 10:46 am

What php code can support image?

Post by teckyan888 »

Let say i create a table call:

Code: Select all

<?php
create table Category(
CategoryID int(20) not null AUTO_INCREMENT,
CategoryName varchar(100) not null,
Description varchar(255) not null,
primary key (CategoryID)
);

?>
Then i wan to upload the image for everytime i insert the new data into my table,what should i do? And also can delete the image when i delete the data at the same time...
Anyone who know that?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Just have a field of varchar(100) or whatever to store the image name, and leave the image on the filesystem as nature intended ;)
When you are deleting the entry from the db you could first grab the image name, then delete the row from the db, then delete the image from the filesystem (maybe use http://php.net/unlink to do it).
teckyan888
Forum Commoner
Posts: 40
Joined: Tue May 11, 2004 10:46 am

Post by teckyan888 »

Ok...i try first...Thanks
Post Reply