SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Database Help

  1. #1
    Non-Member MrLister's Avatar
    Join Date
    Feb 2001
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database Help

    I need to add screenshots to the site but i bumped into several problems. Per game there may be 1-20 or even more screenshots and on a page such as show.php?id=5 there may be 10 but how can i do this? how can i put all the links inside such as images/diablo001.gif, images/diablo002.gif and so on so it shows it in the page. i need this done through a form where they can just specify (multiple pictures, not one by one) and it will automatically create the links inthe db. pleasee help. i need this really badly.

  2. #2
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Confuseled

    Be glad to help you, but I cant for the life of me figure out what you are trying to do...
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your best bet is to use a database table to store the image name along with the id of the game they belong to:

    CREATE TABLE Screenshot (
    game INT NOT NULL,
    filename VARCHAR(100) NOT NULL
    );

    To query the database to find the filenames for screenshots that belong to a certain game:
    PHP Code:
    $sql "SELECT filename FROM Screenshot WHERE game=$id";
    $result mysql_query($sql);
    while (
    $row mysql_fetch_row($result) {
       echo 
    "<p><img scr=\"$row[0]\">";

    That very crude piece of code demonstrates the idea.

  4. #4
    Non-Member MrLister's Avatar
    Join Date
    Feb 2001
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx for the help. it's greatly appriciate it. just one more hting. how can i do this. when they click on browse to upload a pic that they can select multiple files all at once. and that it stores it inside the screenshot database.

  5. #5
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That isn't possible without writing a custom component for selecting and uploading multiple files. The closest you could hope to come with standard forms would be to select the number of files and then present the user with a form with that many file upload fields.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  6. #6
    Non-Member MrLister's Avatar
    Join Date
    Feb 2001
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh ok. yeah i was reading through some sites and found out it's not possible, well it is but really hard.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •