Jump to content

[SOLVED] Inserting data into blob


jdubs

Recommended Posts

Hello,

I'm a bit of a php noob and I'm writing a script that accepts large chunks of notes and then displays them. I'm seeing some rather weird results after I've inserted the test data into phpmyadmin, and then displaying it via my script.

 

It appears that the when I get the data from my select,

("SELECT * FROM notes where note_id = " . $note_id)

 

It spits it out with out any carriage returns.

This is quite annoying as I'm selecting 50-60 lines of data from the blob and then displays the data with out any carriage returns.

 

And I'm curious on how I can keep the carriage returns in the data when I retrieve it.

 

I'm not sure whats going on, as there are several different variables interacting with each other.

First of all, I'm not sure if phpmyadmin is stripping out the carriage returns, when I insert the data into a file, then upload it via phpmyadmin or if my php code is not adaquet to display the carriage returns.

I've also been wondering if I should be using a different table type to store the data, from what I've heard searching through blobs is expensive. :\

 

I hope this doesn't sound confusing but I have no idea of whats going on.

http://xomar.com/haxor/getnote.php?note_id=4

don't laugh, my little script barely works.

 

Should I even be using blobs for 1-2k worth of data?

 

Thanks

Link to comment
Share on other sites

for text use any of these, depending on what you need:

 

TINYTEXT: A character large object column with a maximum length of 255 (2^8 - 1) characters.

TEXT: A character large object column with a maximum length of 65535 (2^16 - 1) characters.

MEDIUMTEXT: A character large object column with a maximum length of 16777215 (2^24 - 1) characters.

LONGTEXT: A character large object column with a maximum length of 4294967295 (2^32 - 1) characters.

 

Link to comment
Share on other sites

I've changed the type of row that holds the information, and when I view the data via phpmyadmin, it displays with the proper carrige returns and everything. But when I view it via my php script its still missing the carriage returns... I've run the select via phpmyadmin and it also displays the correct spacing and what not.

 

So, at this point I'm not sure how to fix my code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.