On 21-Mar-01 WCBaker wrote:
> 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.
No, it returns an array of one element $section1['sectionText'] (bad variable
naming, btw).
> 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?
TEXT - `TEXT' column with a maximum length of 65535 (2^16 - 1)
characters.
> 2. What function might I use (and how can I use it) to correctly display
> the data if stored as something other than varchar?
>
don't confuse C (mysql_query & mysql_real_query) with PHP's mysql_query.
$res=mysql_query(" select sectionText from sectionbinaries where
TestID='$test' and section='$section' ");
if ($res) {
while ($row = mysql_fetch_object($res)) {
echo '<P>Text: ', $row->sectionText;
}
echo '<BR>';
}
Regards,
--
Don Read [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy.
God will forgive you but the bureaucrats won't.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php