Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
2) How can I insert a microsoft word file into a BLOB field of a
table ?
Please, could you help me with a simple example ?
Thank you .
Fab 10 6485
On Thu, 18 Oct 2007 18:36:59 +0200, <el********@yah oo.itwrote:
Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
2) How can I insert a microsoft word file into a BLOB field of a
table ?
Please, could you help me with a simple example ?
mysql_query("IN SERT INTO tablename (fieldname) VALUES
('".mysql_real_ escape_string(f ile_get_content s('/path/to/file'))."')");
--
Rik Wasmus
On Thu, 18 Oct 2007 19:29:54 +0200, Rik Wasmus
<lu************ @hotmail.comwro te:
On Thu, 18 Oct 2007 18:36:59 +0200, <el********@yah oo.itwrote:
>Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
2) How can I insert a microsoft word file into a BLOB field of a table ?
Please, could you help me with a simple example ?
mysql_query("IN SERT INTO tablename (fieldname) VALUES
('".mysql_real_ escape_string(f ile_get_content s('/path/to/file'))."')");
Hmmm,
or: mysql_query("IN SERT INTO tablename (fieldname) VALUES
(LOAD_FILE('/path/to/file'))");
For this you'd have to make sure:
- the database is on the same host as the file
- you have the FILE privilege
- the file is readable
- the filesize is less than max_allowed_pac ket bytes
--
Rik Wasmus
On Oct 18, 6:36 pm, electri...@yaho o.it wrote:
Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
2) How can I insert a microsoft word file into a BLOB field of a
table ?
Please, could you help me with a simple example ?
Thank you .
Fab
I wrote a tutorial on uploading files into a mysql database.
You can read it here : http://wiki.greenquery.com/doku.php?
id=understandin g_php_classes#c reating_uploadh andler
I hope it's for some help to you.
//Michael
On 18 Oct, 17:36, electri...@yaho o.it wrote:
Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
2) How can I insert a microsoft word file into a BLOB field of a
table ?
Please, could you help me with a simple example ?
Thank you .
Fab
Do not multi-post. Cross-post if you must but don't multi
post It wastes people's time. http://www.blakjak.demon.co.uk/mul_crss.htm.
You have had answers from people on 2 different groups. If you had
cross posted instead of multi-posting, everyone would have seen that
the question had been answered.
On 18 Ott, 19:33, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
On Thu, 18 Oct 2007 19:29:54 +0200, Rik Wasmus
<luiheidsgoe... @hotmail.comwro te:
On Thu, 18 Oct 2007 18:36:59 +0200, <electri...@yah oo.itwrote:
Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
2) How can I insert a microsoft word file into a BLOB field of a
table ?
Please, could you help me with a simple example ?
mysql_query("IN SERT INTO tablename (fieldname) VALUES
('".mysql_real_ escape_string(f ile_get_content s('/path/to/file'))."')");
Hmmm,
or: mysql_query("IN SERT INTO tablename (fieldname) VALUES
(LOAD_FILE('/path/to/file'))");
For this you'd have to make sure:
- the database is on the same host as the file
- you have the FILE privilege
- the file is readable
- the filesize is less than max_allowed_pac ket bytes
--
Rik Wasmus
Thank you very much .
Another question:
after I put a text file in a text field,
then, how can I read this field content and put it into
a php variable ?
Many thanks .
Fabrizio el********@yaho o.it wrote:
On 18 Ott, 19:33, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
>On Thu, 18 Oct 2007 19:29:54 +0200, Rik Wasmus <luiheidsgoe.. .@hotmail.comwr ote:
>>On Thu, 18 Oct 2007 18:36:59 +0200, <electri...@yah oo.itwrote: Hallo, I have 2 questions: with php and mysql : 1) How can I insert a text file into a TEXT field of a table ? 2) How can I insert a microsoft word file into a BLOB field of a table ? Please, could you help me with a simple example ? mysql_query(" INSERT INTO tablename (fieldname) VALUES ('".mysql_rea l_escape_string (file_get_conte nts('/path/to/file'))."')");
Hmmm, or: mysql_query("IN SERT INTO tablename (fieldname) VALUES (LOAD_FILE('/path/to/file'))");
For this you'd have to make sure: - the database is on the same host as the file - you have the FILE privilege - the file is readable - the filesize is less than max_allowed_pac ket bytes
-- Rik Wasmus
Thank you very much .
Another question:
after I put a text file in a text field,
then, how can I read this field content and put it into
a php variable ?
Many thanks .
Fabrizio
http://www.php.net/manual/en/ref.mysql.php
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On Thu, 18 Oct 2007 09:36:59 -0700, electric_r wrote:
Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
textarea value="<?php echo thefile; ?>" something like that
>
2) How can I insert a microsoft word file into a BLOB field of a table ?
wouldn't it be more practical to just store the file's path instead of the file itself?
>
Please, could you help me with a simple example ?
Thank you .
Fab
Henri wrote:
On Thu, 18 Oct 2007 09:36:59 -0700, electric_r wrote:
>Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
textarea value="<?php echo thefile; ?>" something like that
He's talking about a table in a SQL database.
>2) How can I insert a microsoft word file into a BLOB field of a table ?
wouldn't it be more practical to just store the file's path instead of the file itself?
Not necessarily. Often times I'll store files in a database. A lot of
good reasons to do so (which should be discussed in a SQL newsgroup).
>Please, could you help me with a simple example ?
Thank you .
Fab
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Henri wrote:
On Thu, 18 Oct 2007 09:36:59 -0700, electric_r wrote:
>Hallo,
I have 2 questions:
with php and mysql :
1) How can I insert a text file into a TEXT field of a table ?
textarea value="<?php echo thefile; ?>" something like that
>2) How can I insert a microsoft word file into a BLOB field of a table ?
wouldn't it be more practical to just store the file's path instead of the file itself?
Actually it isn't.I ended up with EVERYTHING - files and images - in the
database simply because backing up the database then backs up EVERYTHING.
But I wouldn't use a text area to input a file..use the FILE input command.
>Please, could you help me with a simple example ?
Thank you .
Fab
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: me |
last post by:
I'm also having problems getting the bulk insert to work. I don't know
anything about it except what I've gleened from BOL but I'm not seeming to
get anywhere...Hopefully there is some little (or big) problem with my code
that someone can point out that may save me some time.
TIA
CBL
|
by: akej via SQLMonster.com |
last post by:
Hi, i have table with 15 columns
CREATE TABLE . (
PRIMARY KEY ,
NULL ,
NULL ,
NULL ,
NULL ,
(50) NULL ,
NULL
|
by: pk |
last post by:
Sorry for the piece-by-piece nature of this post, I moved it from a
dormant group to this one and it was 3 separate posts in the other
group. Anyway...
I'm trying to bulk insert a text file of 10 columns into a table with
12. How can I specify which columns to insert to? I think format
files are what I'm supposed to use, but I can't figure them out. I've
also tried using a view, as was suggested on one of the many websites
I've...
|
by: NuB |
last post by:
I have a sql query that is doing an update of records, how can I add NULL to
the field in the database if the field on my screen is blank?
example:
I have 5 textboxes, and a user can leave some blank, delete data from a text
box then hit update, how can I have NULL inserted into the field on the
database instead of having a blank record in the db
|
by: Alexander Widera |
last post by:
Hi,
i connect to a ms sql2000server via SqlConnection.
if i make an SqlCommand "INSERT INTO mytable (mytext) VALUES (@mytext)" (or
i make an update),
and i pass the parameter @mytext a simple string, i get NO ERROR and the
database has an new empty row instead of the string which should be there.
mytext is type of "text".
I found out, that this effect only happens if the text is longer than around
900 words... if the text is shorter it...
| |
by: Ted |
last post by:
OK, I tried this:
USE Alert_db;
BULK INSERT funds FROM 'C:\\data\\myData.dat'
WITH (FIELDTERMINATOR='\t',
KEEPNULLS,
ROWTERMINATOR='\r\n');
|
by: Ted |
last post by:
I used bcp to produce the apended format file.
How can it be modified to recognize the quotes that surround the text
fields and not insert the quotes along with the text? Invariably, the
first four columns have text surrounded by quotes and are terminated by
tabs. If the first column has "abc", only abc ought to be inserted
into that field in the table.
Thanks
|
by: ak1dnar |
last post by:
There is a Error getting while i am entering records using this jsp file.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../Connections/conn.jsp" %>
<%
// *** Edit Operations: declare variables
// set the form action variable
String MM_editAction = request.getRequestURI();
if (request.getQueryString() != null && request.getQueryString().length() > 0) {
|
by: SaltyBoat |
last post by:
Needing to import and parse data from a large PDF file into an Access
2002 table: I start by converted the PDF file to a html file. Then
I read this html text file, line by line, into a table using a code
loop and an INSERT INTO query. About 800,000 records of raw text.
Later, I can then loop through and parse these 800,000 strings into
usable data using more code.
The problem I have is that the conversion of the text file, using a...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |