Forum Moderators: coopster

Message Too Old, No Replies

Easy updates

Updating a web page easily

         

megajam02

7:39 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



Ok.
I am building a website for a friend who is opening a business selling used vehicles. He would like to take a picture or two of a vehicle and display all of his vehicles on his site.

Here's the catch. He knows basically NOTHING about computers. Sending email and browsing the web is about all he knows, and expecting him to be able to FTP images and edit html/php etc. is asking way too much.

I was thinking I'd use MySQL and PHP, and build an "Admin" section of the site for him where he would simply click a "Add Vehicle" button, enter the info, browse to the pic(s) and click submit. The page would write the corresponding entry into the database.

I have 2 questions:
1. Is this the correct way to go about this?
2. If yes, can someone point me to a good tutorial for uploading and storing images in MySQL?

Thanks,
Chris

elgumbo

2:32 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



PHP and MySQL are perfect for this.

As you said, you just need a password protected section on the site to make your changes and do your uploads.

You will store all of the car's info in the database and include an image upload script (do a search for PHP image upload script).

You won't actually be putting the image into the database (although this is possible) but rather uploading it to a directory on the server and just adding the location of the image to the database. eg: [yoursite.com...] etc.etc.

That way you can just use the images location the same way as any other piece of data from the database.

eg:


<h1><?php echo $carname;?></h1>
<img src="<?php echo $imageURL;?>" alt="car picture" />

Any help to you?

megajam02

3:00 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



YES! You were a big help. I was struggling about whether to try to learn to store the image in the database or upload it to a directory. I've heard storing jpegs, etc in the database can be very problematic.

I'll do a search and see what I come up with on the script. Is it just as easy to write a script to delete the image from the directory?

Thanks for your help!

Chris

jatar_k

3:36 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



for deleting files you can just

grab the full path to the image from the database
use unlink [php.net] to delete the image