Re: [PHP] php, text file, and mysql

2002-03-07 Thread Andrey Hristov

You can use a string to keep the file content. And then put it the 
mysql(probably a BLOB field)

Best regards,
Andrey Hristov
IcyGEN Corporation


On Thursday 07 March 2002 11:30 pm, you wrote:
 hello everyone.

 i'm wondering if i can do the following:

 FIRST,
 using php, can i create/generate a text file  on-the-fly (not saved to a
 server)

 THEN,
 insert the actual text file (and not its contents) into a mysql database.



 many thanks in advance,


 gregory hernandez
 [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php, text file, and mysql

2002-03-07 Thread Erik Price


On Thursday, March 7, 2002, at 04:30  PM, gregory hernandez wrote:

 i'm wondering if i can do the following:

 FIRST,
 using php, can i create/generate a text file  on-the-fly (not saved to a
 server)

 THEN,
 insert the actual text file (and not its contents) into a mysql 
 database.

Sorry, but I don't really understand the question.  If you are creating 
or generating a text file, the word file indicates that this is 
represented by an entity in a filesystem -- thus, it would be saved to a 
server.  Are you asking if you can create/generate text without saving 
it as a file on the server, but rather just storing the text in memory 
temporarily?  If so, then yes --

-- and the second question I haven't really figured out either.  You 
want to store a text file into a MySQL database but not the contents of 
that file?  It seems like in the first question you want to have 
contents without a file, and in the second you want a file without 
contents!  :)

Unless someone else figures out what you want and helps you, ask again 
but describe what you want a little bit more.  PHP can do a lot of 
things.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php, text file, and mysql

2002-03-07 Thread gregory hernandez

Erik:

thank for answering my first question:
 the word file indicates that this is represented by an entity in a
 filesystem -- thus, it would be saved to a server.


now let me rephrase the second part.  what i meant to say was the following:

can i insert the actual file (i.e. document.txt, of course with it
contents) into a mysql?

in other words, i don't want to read the contents of the file and insert the
contents into a field in mysql.  i want to insert the actual file into the
database.  is this possible?


thanks again in advance.

gregory


on 3/7/02 12:44 PM, Erik Price at [EMAIL PROTECTED] wrote:

 
 On Thursday, March 7, 2002, at 04:30  PM, gregory hernandez wrote:
 
 i'm wondering if i can do the following:
 
 FIRST,
 using php, can i create/generate a text file  on-the-fly (not saved to a
 server)
 
 THEN,
 insert the actual text file (and not its contents) into a mysql
 database.
 
 Sorry, but I don't really understand the question.  If you are creating
 or generating a text file, the word file indicates that this is
 represented by an entity in a filesystem -- thus, it would be saved to a
 server.  Are you asking if you can create/generate text without saving
 it as a file on the server, but rather just storing the text in memory
 temporarily?  If so, then yes --
 
 -- and the second question I haven't really figured out either.  You
 want to store a text file into a MySQL database but not the contents of
 that file?  It seems like in the first question you want to have
 contents without a file, and in the second you want a file without
 contents!  :)
 
 Unless someone else figures out what you want and helps you, ask again
 but describe what you want a little bit more.  PHP can do a lot of
 things.
 
 
 Erik
 
 
 
 
 
 
 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php, text file, and mysql

2002-03-07 Thread Anas Mughal

Are you planning on using MySQL as a filesystem?

There seems to be great confusion here.
Good luck!



--- gregory hernandez [EMAIL PROTECTED] wrote:
 hello everyone.
 
 i'm wondering if i can do the following:
 
 FIRST,
 using php, can i create/generate a text file 
 on-the-fly (not saved to a
 server)
 
 THEN,
 insert the actual text file (and not its contents)
 into a mysql database.
 
 
 
 many thanks in advance,
 
 
 gregory hernandez
 [EMAIL PROTECTED]
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Anas Mughal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Tel: 973-249-6665

__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php, text file, and mysql

2002-03-07 Thread Erik Price


On Thursday, March 7, 2002, at 07:16  PM, gregory hernandez wrote:

 can i insert the actual file (i.e. document.txt, of course with it
 contents) into a mysql?

 in other words, i don't want to read the contents of the file and 
 insert the
 contents into a field in mysql.  i want to insert the actual file into 
 the
 database.  is this possible?

Yes you can, though it might be an inefficient way of doing it unless 
you have some reason to do it this way.  Look into the column type 
BLOB (binary large object), it lets you store binary large objects, 
such as images or files or anything, really.

Why inefficient?  Well, for one thing, BLOBs don't retrieve as quickly 
as regular fields, for reasons I don't altogether know.  Also, you won't 
be able to form a query to search for any characteristics of a BLOB, 
since MySQL will treat the BLOB as a BLOB and doesn't try to imagine 
what's inside it -- as opposed to, say, a VARCHAR column.  There is also 
a TEXT column type for very long text strings, and I forget whether or 
not the contents of these can be used in queries -- can someone please 
confirm this?  But basically, almost any other column type is valid 
subject matter for forming queries.

But for storing images and PDFs or other binary data, there's no other 
way.

Note that many MySQL wizards will recommend that instead of storing 
binary data in a database, use a filesystem to store the data and then 
use the database to create a sort of directory for quickly locating 
those files in the filesystem, remembering the path to the file or 
something.  I think this is how a lot of web sites incorporate graphic 
content in with their database (text) content (including mine).


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] php, text file, and mysql

2002-03-07 Thread Jason Murray

 But for storing images and PDFs or other binary data, there's 
 no other way.

Actually, after having some problems with BLOB columns when 
mysqldump'ing and moving the data into a new database, I did
find another way. I borrowed a trick from MIME mail handling,
and base64_encod'ed, then chunk_split'ed the data. This makes
it very text-field friendly.

 Note that many MySQL wizards will recommend that instead of 
 storing binary data in a database, use a filesystem to store 
 the data and then use the database to create a sort of 
 directory for quickly locating those files in the filesystem, 

There's a problem with this, it assumes that you only use one
filesystem for your site. In the case of Melbourne IT / INWW,
we have 5 or 6 web servers that load balance. If a user uploads 
data and we copy it to the filesystem, then it's only available
on 1 web server. This is why we put it in the database. :)

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] php, text file, and mysql

2002-03-07 Thread Darren Gamble

Good day,

This isn't really on the topic of PHP.

But, to answer your question- yes, MySQL will let you do lots of neat things
with those large text fields, like looking for substrings and such.  If you
want to store some text information, even that which might have special
characters, line feeds and so forth, the TEXT field is definately the way
to go.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 07, 2002 4:10 PM
To: gregory hernandez
Cc: PHP NEWS
Subject: Re: [PHP] php, text file, and mysql



On Thursday, March 7, 2002, at 07:16  PM, gregory hernandez wrote:

 can i insert the actual file (i.e. document.txt, of course with it
 contents) into a mysql?

 in other words, i don't want to read the contents of the file and 
 insert the
 contents into a field in mysql.  i want to insert the actual file into 
 the
 database.  is this possible?

Yes you can, though it might be an inefficient way of doing it unless 
you have some reason to do it this way.  Look into the column type 
BLOB (binary large object), it lets you store binary large objects, 
such as images or files or anything, really.

Why inefficient?  Well, for one thing, BLOBs don't retrieve as quickly 
as regular fields, for reasons I don't altogether know.  Also, you won't 
be able to form a query to search for any characteristics of a BLOB, 
since MySQL will treat the BLOB as a BLOB and doesn't try to imagine 
what's inside it -- as opposed to, say, a VARCHAR column.  There is also 
a TEXT column type for very long text strings, and I forget whether or 
not the contents of these can be used in queries -- can someone please 
confirm this?  But basically, almost any other column type is valid 
subject matter for forming queries.

But for storing images and PDFs or other binary data, there's no other 
way.

Note that many MySQL wizards will recommend that instead of storing 
binary data in a database, use a filesystem to store the data and then 
use the database to create a sort of directory for quickly locating 
those files in the filesystem, remembering the path to the file or 
something.  I think this is how a lot of web sites incorporate graphic 
content in with their database (text) content (including mine).


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php, text file, and mysql

2002-03-07 Thread Julio Nobrega

  Hi, just two quick notes:

About text and similar fields:

http://mysql.com/doc/S/t/String_types.html

About not storing images:

http://mysql.com/doc/T/i/Tips.html (close to the middle).

  That's it :-)

--
Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php