I've created a MySQL database to store a large amount of text. Since
the text data type in MySQL is limited to 255 characters, I added a
BLOB column. I created an PHP input screen to enter the large text.
It seems to work. But, I cannot verify the entry, because the
standard select SQL does not display the contents. I want to
retrieve the contents from the database and display on a web page.
The retrieval seems to occur. But, I can't display the results,
because I must not be done the proper conversion from BLOB to ordinary
text.
Can somebody help me resolve this problem?
Here is the insert code I'm using.
$newtext = addslashes($blob);
@ $db = mysql_connect('localhost', '<database>', '<password>');
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("<database>");
$query = "insert into blog values ('$newtext')";
$result = mysql_query($query);
if ($result)
{
echo mysql_affected_rows()." text item inserted into
database.";
}
Here is the retrieval code I'm using.
$query = "select blogtext from blog";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$blog = $row['blogtext'];
$wraptext = wordwrap($blog, 80, "\n", 1);
echo $wraptext;
}
It displays nothing on my page.
Thanks in advance. 5 2653
I noticed that Message-ID:
<e4**************************@posting.google.com > from Bob Kaku
contained the following: $query = "insert into blog values ('$newtext')";
$query = "insert into blog (blogtext) values ('$newtext')";
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Geoff Berrow <bl******@ckdog.co.uk> wrote in message news:<55********************************@4ax.com>. .. I noticed that Message-ID: <e4**************************@posting.google.com > from Bob Kaku contained the following:
$query = "insert into blog values ('$newtext')";
$query = "insert into blog (blogtext) values ('$newtext')";
Geoff,
I tried your suggestion. The insert seems to work. But, I still have
the problem of not being able to display the contents of this BLOB
column. Thanks anyway. Perhaps, someone else has a solution.
Bob Kaku bo*****@yahoo.com
I noticed that Message-ID:
<e4**************************@posting.google.com > from Bob Kaku
contained the following: Geoff,
I tried your suggestion. The insert seems to work. But, I still have the problem of not being able to display the contents of this BLOB column. Thanks anyway. Perhaps, someone else has a solution.
'Seems' to? Can't you check using phpMyAdmin or something?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
On 18 Mar 2004 19:47:35 -0800, bo*****@yahoo.com (Bob Kaku) wrote: I've created a MySQL database to store a large amount of text. Since the text data type in MySQL is limited to 255 characters, I added a BLOB column.
Actually, TEXT can store 64k. BLOB isn't for text, it's for binary data
(although the only real difference AFAIK is that using the binary types turns
off case-insensitivity).
VARCHAR can only store 255.
--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Andy Hassall <an**@andyh.co.uk> wrote in message news:<8j********************************@4ax.com>. .. On 18 Mar 2004 19:47:35 -0800, bo*****@yahoo.com (Bob Kaku) wrote:
I've created a MySQL database to store a large amount of text. Since the text data type in MySQL is limited to 255 characters, I added a BLOB column.
Actually, TEXT can store 64k. BLOB isn't for text, it's for binary data (although the only real difference AFAIK is that using the binary types turns off case-insensitivity).
VARCHAR can only store 255.
Yes, thanks for the answer. I actually found this out myself by doing
a little more research. I now know I can use TEXT, MEDIUMTEXT or
LONGTEXT. But, TEXT seems fine for most uses. I need to examine the
online manual a little deeper before posting a message
Bob Kaku This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jty202 |
last post by:
Hi,
I like to know how I can retrieve an image and set it to an Image object.
I seem to can't find anything on the net that can help me on this. Thanks
|
by: Paul Kennedy |
last post by:
I have a situation where I am utilizing code from MSDN to insert XLS files
into a Microsoft Access Table in a column of Ole Object using VBA and DAO.
That code also provides me with a method to...
|
by: Dennis |
last post by:
How can I save then retrieve an image from an access Database using VB.Net?
--
Dennis in Houston
|
by: Utilisateur1 |
last post by:
Hello,
I've a problem retrieving a blob column from oracle.
I'm using oledbadapter to fill a dataset like that
oledataadap.fill(ds,"query");
I'm also using ColumnMapping to have more friendly...
|
by: pmz |
last post by:
Dear Group,
I'm connecting in C# with remote (BSD) MySQL server with ODBC Driver,
and I'm trying to find the best sollution in such problem:
As I've read on MySQL manual, they have suggested...
|
by: Peter Afonin |
last post by:
Hello,
I have Word documents stored in the Oracle database in the BLOB field
that I need to retrieve. I've found the way of doing it:
While dr.Read
sName = dr("TE_PM_ATTACH_NAME")
bLob =...
|
by: matt |
last post by:
hello,
im doing my first ASP.NET app that inserts & retrieves files from
Oracle (no need for a discussion on *that*!).
i learned first-hand of the somewhat awkward technique for inserting...
|
by: coony |
last post by:
Hi everyone,
I got an annoying thing going on.
I've got an MSSQL db which is filled with different data, used by another program (T-Plan). I should read some table to import in another DB. The...
|
by: sana krishna |
last post by:
Pls Help me--------------
I use ASP(C#.NET) and oracle.
When i retrive image from database .it display error message...
System.InvalidCastException: Unable to cast object of type 'System.DBNull'...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |