List:General Discussion« Previous MessageNext Message »
From:WCBaker Date:March 21 2001 2:02am
Subject:Is storing a whack of text in a binary format ok?
View as plain text  
Hi,

I can store and retrieve binary data in the form of image or sound files.
However, I wanted to store up to say, 10,000 bytes of textual data.  Since
varchar has a 255 byte ceiling I thought that mediumblob might be nice for
this.   I can store the stuff as mediumblob without difficulty.

However, when I try to retrieve the mediumblob (just character data
originally) via PHP4, I tried this:

$sectionText1=mysql_query(" select sectionText from sectionbinaries where
TestID='$test' and section='$section' ");
$section1=mysql_fetch_row($sectionText1);


This section1 array gives me a raft of stuff, including a lot more than I
want.   So I looked in the manual and found that:
   "mysql_query() cannot be used for queries that contain binary data; you
should use mysql_real_query() instead.  "


SO I switched to:
$sectionText1=mysql_real_query(" select sectionText from sectionbinaries
where TestID='$test' and section='$section' ");
$section1=mysql_fetch_row($sectionText1);

and received the following error:
Fatal error: Call to undefined function: mysql_real_query() in data.php3 on
line 210


Can anyone point me in the correct direction?

1.  It is character data originally -- should I be using a mediumblob format
to get 10,000 bytes or so into storage?
2.  What function might I use (and how can I use it) to correctly display
the data if stored as something other than varchar?

Thanks for your time!

-Warren





Thread
Is storing a whack of text in a binary format ok?WCBaker21 Mar
  • RE: Is storing a whack of text in a binary format ok?Don Read21 Mar