Jump to content

Archived

This topic is now archived and is closed to further replies.

mbvo

blob

Recommended Posts

How do I read from a blob field?  And is it correct that I would use a text area to write to a blob?  if not what do I write using a text area?

Share this post


Link to post
Share on other sites
my code is:

$result = mysql_query("SELECT * FROM calendar where num = ".$_GET['num']);
$row = mysql_fetch_array($result);
.
.
.
echo "<BR><BR>Description:<BR>'".$row['description']."'";

I'm sure it's getting the correct row, because it's displaying other data from it, but it won't display anything from the description filed(which is a blob data type).

Share this post


Link to post
Share on other sites
there's a simple rule I personally follow myself regarding PHP/MySQL. If you don't know what something is, you either don't need it or should look it up in the manual if you're curious. (I don't mean that in a dismissive way either  :) ).

There are so many different field types in MySQL that cater for all sorts. Me personally, i've only probably used about 6 or 7 different ones ever (less if you dont consider the variants - SMALLINT, INT, BIGINT, etc). Some of the others I will probably never have a use for.

Getting data from a blob field is no different really from any other field in terms of getting data from it. A normal SELECT will suffice. Whilst I can't honestly say I know exactly the full/proper use for the blob field, i've always used it to store binary data. Anything that is generally entered via a <form> can be put in the basic types - VARCHAR (or CHAR), INT (or its smaller/larger variants), TEXT, etc. a textarea would be suited to putting data into a TEXT field, not a BLOB.

hope that makes sense
cheers
Mark

Share this post


Link to post
Share on other sites
perfectly, and after posting I've been looking around more on google and playing with my code, and i got it to display all but the first line using a varchar field, and changing it to nl2br($row['description']).  But now my question is why is it now displaying the first line?

Share this post


Link to post
Share on other sites
[quote author=mbvo link=topic=110623.msg447539#msg447539 date=1160083675]
perfectly, and after posting I've been looking around more on google and playing with my code, and i got it to display all but the first line using a varchar field, and changing it to nl2br($row['description']).  But now my question is why is it now displaying the first line?
[/quote]

I feel stupid now, I just looked at the source code for the page and the browser is interperting it wrong was my problem.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.