mbvo Posted October 5, 2006 Share Posted October 5, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/23113-blob/ Share on other sites More sharing options...
mbvo Posted October 5, 2006 Author Share Posted October 5, 2006 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). Quote Link to comment https://forums.phpfreaks.com/topic/23113-blob/#findComment-104574 Share on other sites More sharing options...
redbullmarky Posted October 5, 2006 Share Posted October 5, 2006 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 sensecheersMark Quote Link to comment https://forums.phpfreaks.com/topic/23113-blob/#findComment-104575 Share on other sites More sharing options...
mbvo Posted October 5, 2006 Author Share Posted October 5, 2006 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 Link to comment https://forums.phpfreaks.com/topic/23113-blob/#findComment-104580 Share on other sites More sharing options...
mbvo Posted October 5, 2006 Author Share Posted October 5, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/23113-blob/#findComment-104593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.