473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Displaying the contents of a mediumblob

nathj
938 Expert 512MB
Hi,

I have a system, developed in PHP with a MySQL database that enables members to review events they have been to or resources they have downloaded.

When they write the review the data is stored in a medium blob field. I then want this review to be available for the author to edit.

Unfortunately I cannot display the contents of the mediumblob. I am trying to use a textarea control on my webform and it's just not working:

[php]
<textarea name="review" id="review" cols="44" rows="8" title="Please provide detailed comments for your review">' . $lcReview . '</textarea>
[/php]

Any ideas on how to be able to display this content?

Many thanks
nathj
Oct 9 '07 #1
7 4282
nathj
938 Expert 512MB
Okay, that proves it - it's notmy day today! The prblem was nothing to do with the data type but rather how the data was being passed between pages.

I had built up a query string and the item in the query string that hela dht e review data was called review. However the query string looked like:

Expand|Select|Wrap|Line Numbers
  1. showreviewdata.php?id=3&rating=5&reviewamazing really amazing
  2.  
The missing '=' is all it was. I feel a bit stupid and I've efinitely wasted time on this.

Thanks
nathj
Oct 9 '07 #2
Atli
5,058 Expert 4TB
Hi nathj.
Glad you solved your problem!

One question tho.
Why are you storing the text in a BLOB field?
Oct 9 '07 #3
nathj
938 Expert 512MB
Hi nathj.
One question tho.
Why are you storing the text in a BLOB field?
I'm beginng to wonder this myself. I hadn't realised the capacity of a varchar field and a char field at only 255 is not enough for a full bodied review.

I may change it to varchar, what are the pros and cons of each of these types?

Cheers
nathj
Oct 9 '07 #4
Atli
5,058 Expert 4TB
Well, VARCHAR fields are designed for text. They store character strings and have a character set.
BLOB fields are designed for binary data. They store byte strings and do not have a character set.

You should consider the TEXT type. It works pretty much the same as VARCHAR but can contain a lot more text.

Check out this page in the MySQL Reference Manual.
Oct 9 '07 #5
nathj
938 Expert 512MB
Well, VARCHAR fields are designed for text. They store character strings and have a character set.
BLOB fields are designed for binary data. They store byte strings and do not have a character set.

You should consider the TEXT type. It works pretty much the same as VARCHAR but can contain a lot more text.

Check out this page in the MySQL Reference Manual.
Atli,

Thanks for that, it has been really helpful. I've only really started using MySQL in last 5months and my previous experience was with a database that had character fields, general fields and memo fields. The character field had a liength of 255 maximum, the general field was used for storing images, doc files etc and the memo field was for text of almost any length.

The result of all this is that when I was designing the database for the current project I picked field types that appeared closest to what I was used to - not necessarily a smart move.

The document you pointed me towards makes a lot of sense and so I am changing my database to use the TEXT type instead of the BLOB type. I have cases where I have used varchar for items up to 255 characters long and som I'm going to leaave these alone for now as I thikn this serves my purposes nicely.

Thanks again for your help, this forum is great, post one question and learn a whole bunch of related stuff.

One final question about MySQL (now it turns out I have posted to the wrong forum - sorry) What collation tye should I use? I have been using utf8_bin? Is this okay? I've tried to find some help on the net but everything seems to say 'oh well what the heck.'.

Thanks
nathj
Oct 10 '07 #6
Atli
5,058 Expert 4TB
One final question about MySQL (now it turns out I have posted to the wrong forum - sorry) What collation tye should I use? I have been using utf8_bin? Is this okay? I've tried to find some help on the net but everything seems to say 'oh well what the heck.'.
As far as I know, the collation only controls how the rows will be sorted and which chars match which chars in a search (e.g. if 'á' will just match 'á' or if it will match 'a' as well).

In most cases I think it is safe to just leave it out, have MySQL set the default collation for the charset. Unless you have a reason not to.

You can check out Examples of the Effect of Collation int the MySQL Reference Manual.
Oct 10 '07 #7
nathj
938 Expert 512MB
As far as I know, the collation only controls how the rows will be sorted and which chars match which chars in a search (e.g. if 'á' will just match 'á' or if it will match 'a' as well).

In most cases I think it is safe to just leave it out, have MySQL set the default collation for the charset. Unless you have a reason not to.

You can check out Examples of the Effect of Collation int the MySQL Reference Manual.
That's great, it makes a lot of sense now, I'll just leave it at the default. Iv'e read the article and played around a bit and everything seems to be sorting as I would expect so fantastic.

Cheers
nathj
Oct 10 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ralph Freshour | last post by:
My .php app displays an image on the web page, I notice that different ..jpg images display "funny" - apparently they all have slightly different image widths and heights yet in the image tag I...
1
by: semi | last post by:
Hello, I am using VS C++ to make a gui that displays a text file contents from main dialog. So I created main dialog and another dialog for text file viewer. From the main dialog, I call text...
9
by: Ioannis Vranos | last post by:
Here is a similar code to one that I saw in a video on the web: #include <cstdio> #include <cstring> void somefunc(const char *input) { using namespace std;
1
by: jlea | last post by:
Does anyone know of a nice little .NET class that throws the contents of a supplied file to a scrollable window/form/control?
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
6
by: Al Wilkerson | last post by:
Hi, Does anyone know how to display the contents of a DataGrid on another aspx page. I have a aspx page that when the user clicks on a link button the database is queried and I want the results...
1
by: mridulmurari | last post by:
Hey. I need help with a certain problem I'm facing in VB6. I need to display the contents of multiple items in a listview. The situation is this : Everytime i double-click on an item in a...
4
by: merlin_at | last post by:
Okay, I'm still really new to javascript, so I'm looking for a little help. I want to grab a name with I'm trying to display a hyperlink in my body, but one of my functions overwrites it. The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.