databases

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Goofy

    databases

    Hi all,

    i have to create a game for young children aged from 6 -14 years old. the
    game will aid them to learn a new language easily. there will be a spelling
    game and a photo game. the words and the pictures must be stored in mysql.do
    u know how should i store a picture in mysql? what should i notice before i
    create the tables? does anyone know a web site about the design of
    databases?


  • Nel

    #2
    Re: databases

    "Goofy" <garyfalia.anas tasopoulou@durh am.ac.uk> wrote in message
    news:cf061g$e3l $1@heffalump.du r.ac.uk...[color=blue]
    > Hi all,
    >
    > i have to create a game for young children aged from 6 -14 years old. the
    > game will aid them to learn a new language easily. there will be a[/color]
    spelling[color=blue]
    > game and a photo game. the words and the pictures must be stored in[/color]
    mysql.do[color=blue]
    > u know how should i store a picture in mysql? what should i notice before[/color]
    i[color=blue]
    > create the tables? does anyone know a web site about the design of
    > databases?
    >[/color]
    Store filename in table and store images as files IMHO.

    Nel.


    Comment

    • Ian.H

      #3
      Re: databases

      On Fri, 06 Aug 2004 21:01:26 +0100, Nel wrote:
      [color=blue]
      > "Goofy" <garyfalia.anas tasopoulou@durh am.ac.uk> wrote in message
      > news:cf061g$e3l $1@heffalump.du r.ac.uk...[color=green]
      >> Hi all,
      >>
      >> i have to create a game for young children aged from 6 -14 years old. the
      >> game will aid them to learn a new language easily. there will be a[/color]
      > spelling[color=green]
      >> game and a photo game. the words and the pictures must be stored in[/color]
      > mysql.do[color=green]
      >> u know how should i store a picture in mysql? what should i notice before[/color]
      > i[color=green]
      >> create the tables? does anyone know a web site about the design of
      >> databases?
      >>[/color]
      > Store filename in table and store images as files IMHO.
      >
      > Nel.[/color]


      Yes! definitely!! =)

      I wrote a post on the Smarty forum after discussion with boots there about
      some issues and pitfalls I encountered while storing files in a database.
      I attempted it out of curiousity (every other upload script etc has always
      stored files in the filesystem) and after spending a fair few hours on it,
      reverted back to filesystem storage.

      Many ideas were tested, but nothing compares to physically storing files
      and relative info only in the DB.



      Regards,

      Ian

      --
      Ian.H
      digiServ Network
      London, UK


      Comment

      • Doug B

        #4
        Re: databases


        "Ian.H" <ian@WINDOZEdig iserv.net> wrote in message
        news:pan.2004.0 8.06.20.18.55.9 06000@bubbleboy .digiserv.net.. .[color=blue]
        > On Fri, 06 Aug 2004 21:01:26 +0100, Nel wrote:
        >[color=green]
        > > "Goofy" <garyfalia.anas tasopoulou@durh am.ac.uk> wrote in message
        > > news:cf061g$e3l $1@heffalump.du r.ac.uk...[color=darkred]
        > >> Hi all,
        > >>
        > >> i have to create a game for young children aged from 6 -14 years old.[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > >> game will aid them to learn a new language easily. there will be a[/color]
        > > spelling[color=darkred]
        > >> game and a photo game. the words and the pictures must be stored in[/color]
        > > mysql.do[color=darkred]
        > >> u know how should i store a picture in mysql? what should i notice[/color][/color][/color]
        before[color=blue][color=green]
        > > i[color=darkred]
        > >> create the tables? does anyone know a web site about the design of
        > >> databases?
        > >>[/color]
        > > Store filename in table and store images as files IMHO.
        > >
        > > Nel.[/color]
        >
        >
        > Yes! definitely!! =)
        >
        > I wrote a post on the Smarty forum after discussion with boots there about
        > some issues and pitfalls I encountered while storing files in a database.
        > I attempted it out of curiousity (every other upload script etc has always
        > stored files in the filesystem) and after spending a fair few hours on it,
        > reverted back to filesystem storage.
        >
        > Many ideas were tested, but nothing compares to physically storing files
        > and relative info only in the DB.
        >
        >
        >
        > Regards,
        >
        > Ian
        >
        > --
        > Ian.H
        > digiServ Network
        > London, UK
        > http://digiserv.net/
        >[/color]

        This is by far the simplest way, and most flexible. While the database CAN
        store the files using BLOB (mysql anyway) it is not a very good way to go in
        anything I have done. Instead, I save the paths to the files, or some
        portion of the path and file name, in the database and build the links and
        references from that information. Works very well and allows the database
        to stay slimmed down. It only seems more complicated, but in the end, it
        isnt.



        Comment

        • provaands

          #5
          Re: databases

          Goofy wrote:
          [color=blue]
          > Hi all,
          >
          > i have to create a game for young children aged from 6 -14 years old. the
          > game will aid them to learn a new language easily. there will be a spelling
          > game and a photo game.[/color]

          it is online?
          is english-italian?
          there are other similar online (english-italian)?

          Comment

          • Goofy

            #6
            Re: databases


            ? "provaands" <invalidamail@t ucossa.it> ?????? ??? ??????
            news:UP6Rc.8576 9$OR2.4615062@n ews3.tin.it...[color=blue]
            > Goofy wrote:
            >[color=green]
            > > Hi all,
            > >
            > > i have to create a game for young children aged from 6 -14 years old.[/color][/color]
            the[color=blue][color=green]
            > > game will aid them to learn a new language easily. there will be a[/color][/color]
            spelling[color=blue][color=green]
            > > game and a photo game.[/color]
            >
            > it is online?
            > is english-italian?
            > there are other similar online (english-italian)?[/color]

            it will be on-le and yes it is english? do u know if i can find anywhere
            similar script for that?


            Comment

            • Goofy

              #7
              Re: databases


              Ï "Doug B" <yeah@right.com > Ýãñáøå óôï ìÞíõìá
              news:fG6Rc.1112 9$Q77.3614@fe58 .usenetserver.c om...[color=blue]
              >
              > "Ian.H" <ian@WINDOZEdig iserv.net> wrote in message
              > news:pan.2004.0 8.06.20.18.55.9 06000@bubbleboy .digiserv.net.. .[color=green]
              > > On Fri, 06 Aug 2004 21:01:26 +0100, Nel wrote:
              > >[color=darkred]
              > > > "Goofy" <garyfalia.anas tasopoulou@durh am.ac.uk> wrote in message
              > > > news:cf061g$e3l $1@heffalump.du r.ac.uk...
              > > >> Hi all,
              > > >>
              > > >> i have to create a game for young children aged from 6 -14 years[/color][/color][/color]
              old.[color=blue]
              > the[color=green][color=darkred]
              > > >> game will aid them to learn a new language easily. there will be a
              > > > spelling
              > > >> game and a photo game. the words and the pictures must be stored in
              > > > mysql.do
              > > >> u know how should i store a picture in mysql? what should i notice[/color][/color]
              > before[color=green][color=darkred]
              > > > i
              > > >> create the tables? does anyone know a web site about the design of
              > > >> databases?
              > > >>
              > > > Store filename in table and store images as files IMHO.
              > > >
              > > > Nel.[/color]
              > >
              > >
              > > Yes! definitely!! =)
              > >
              > > I wrote a post on the Smarty forum after discussion with boots there[/color][/color]
              about[color=blue][color=green]
              > > some issues and pitfalls I encountered while storing files in a[/color][/color]
              database.[color=blue][color=green]
              > > I attempted it out of curiousity (every other upload script etc has[/color][/color]
              always[color=blue][color=green]
              > > stored files in the filesystem) and after spending a fair few hours on[/color][/color]
              it,[color=blue][color=green]
              > > reverted back to filesystem storage.
              > >
              > > Many ideas were tested, but nothing compares to physically storing files
              > > and relative info only in the DB.
              > >
              > >
              > >
              > > Regards,
              > >
              > > Ian
              > >
              > > --
              > > Ian.H
              > > digiServ Network
              > > London, UK
              > > http://digiserv.net/
              > >[/color]
              >
              > This is by far the simplest way, and most flexible. While the database[/color]
              CAN[color=blue]
              > store the files using BLOB (mysql anyway) it is not a very good way to go[/color]
              in[color=blue]
              > anything I have done. Instead, I save the paths to the files, or some
              > portion of the path and file name, in the database and build the links and
              > references from that information. Works very well and allows the database
              > to stay slimmed down. It only seems more complicated, but in the end, it
              > isnt.
              >[/color]

              do u know how should save the paths and file name in the database? is there
              any tutorial? because i only know how to store text in the database. how
              should i build the links and[color=blue]
              > references from that information? any on-line tutorial? and something[/color]
              else. which command should i use ( php) in order to retrieve these
              information?[color=blue]
              >
              >[/color]


              Comment

              • Ian.H

                #8
                Re: databases

                On Sat, 07 Aug 2004 17:42:41 +0100, Goofy wrote:


                [ snip ]

                [color=blue]
                > do u know how should save the paths and file name in the database? is there
                > any tutorial? because i only know how to store text in the database. how
                > should i build the links and[color=green]
                >> references from that information? any on-line tutorial? and something[/color]
                > else. which command should i use ( php) in order to retrieve these
                > information?[/color]


                I'd store just the filename (grab this value from
                $_FILES['field_name']['name'] (where 'field_name' is the name of your form
                element).

                Unless you have a highly configurable site where the upload directory
                maybe dynamic, you could just define the dir and concatenate to create the
                full path:


                [ upload.php ]
                <?php
                /**
                * If upload.php is in your Web root, this would prevent
                * files being accessed directly without going through a script
                */
                define('UPLOAD_ DIR', dirname(__FILE_ _) . '/../files/');

                $filename = $_FILES['upload_file']['name'];

                /**
                * Do bulk of processing
                * [ ... ]
                */
                if (move_uploaded_ file($src, UPLOAD_DIR . $filename) {
                /**
                * Store $filename in database
                */
                }
                ?>


                [ download.php ]
                [ example link: foo.com/download.php?id =1 ]
                <?php
                define('UPLOAD_ DIR', dirname(__FILE_ _) . '/../files/');

                /**
                * Grab filename from database
                * that matches ID #1
                * (Assuming $row is your assoc array from DB)
                */
                $filename = $row['filename'];

                /**
                * Send headers etc (see php.net under 'header')
                */
                header('Content-type: application/octet-stream');
                /* etc etc etc */

                @readfile(UPLOA D_DIR . $filename);
                exit;
                ?>


                This is a really quick outline of how I normally do things (please note
                the lack of validation in this example code) but it works pretty well.

                You may want to define more info like a list (array) of mime-types
                according to file extension and making the above header() call relative to
                the mime-type rather than sending everything application-octet-stream:


                $mimeTypes = array('
                'zip' => 'archive/x-zip',
                'jpg' => 'image/jpeg'
                );


                for example.. but there's lots you can play with maybe once you have the
                base of the code sorted =)


                HTH.



                Regards,

                Ian

                --
                Ian.H
                digiServ Network
                London, UK


                Comment

                Working...