1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    I have a simple script submits a name and number to a MySql database and its searchable, Now i want to take it to the next level and attach a picture to the name and number that i submit and have the picture show up when i run a query for the name. what is the best possible way to doing this? Thanks so much
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Rep Power
    First you need to decide whether u want to store the actual picture in the database...or just store the url to the picture in the database.

    If you just want the link in the database.. go here http://www.evilwalrus.com/viewcode.p...code_php&id=27 to see how u do it.

    For the other method...i dunno I saw a tutorial on it at one of the big sites once though

  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Caro, Michigan
    Rep Power
    the command for adding a column to the mysql table is:

    alter table <table_name> add column picture varchar(20);

    it's easier if all of your images are stored in one directory, that way you can just save the name, instead of all the path info. if you do have to store path info, you might want to make varchar larger than 20.

    then, to get the data back out...

    $query = mysql_db_query($database,"select picture from table_name where name='$name');
    $result = mysql_fetch_array($query);

    then, where ever you want to show the picture, use:

    <img src="images/<?php echo $result["picture"]; ?>" border=0>

    Hopefully that get's you going, email me if you have any other questions.

    ---John Holmes

Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 16th, 2004, 11:21 PM
  2. Uploading files using asp.net with virus scan
    By tiger5000 in forum Antivirus Protection
    Replies: 0
    Last Post: February 14th, 2004, 06:52 AM
  3. Security issues with uploading image files
    By paulc218 in forum PHP Development
    Replies: 4
    Last Post: January 26th, 2004, 12:03 PM
  4. uploading files and checking extention
    By tim0 in forum Perl Programming
    Replies: 3
    Last Post: January 19th, 2004, 12:27 AM
  5. Uploading files...
    By the flow in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2004, 09:10 PM

IMN logo majestic logo threadwatch logo seochat tools logo