Avatar billede holmqvist Nybegynder
01. marts 2005 - 22:34 Der er 2 kommentarer og
1 løsning

Storing text in DB

What type of data is best to use to store text in my database? Text, Blob, something else? It could be everything from one sentence to 10 or more..

I've used "text" so far because it just seemed like the obvious choice. But now that I've tried to extract the data from the DB, all the "varchar" columns was no problem at all, but I've got NOTHING from the "text" column. Is there anything speciell you need to do with text when you wanna get the data? The array slot seems to be empty when I try to look at it in PHP..

while ($arrPerson = mysql_fetch_array($result) {
this works fine (varchar)--> $name = $arrPerson["name"]
here I get an empty var(text)--> $comment = $arrPerson["comment"]

^that isn't my actual code so syntax errors are probably not there in the real one, in case you find any..
Avatar billede arne_v Ekspert
01. marts 2005 - 22:36 #1
TEXT takes up to 64 KB of text

sounds as the rigth choice
Avatar billede arne_v Ekspert
01. marts 2005 - 22:38 #2
And have no clue why your code is not working, but then I am not an PHP expert
Avatar billede holmqvist Nybegynder
02. marts 2005 - 10:49 #3
Thanks for the confirmation on TEXT.
The problem was that i fetched from two tables and both of them had a column named comment, so I had to specify alias for them to keep them apart.. (part of sql) ... ,p.comment pcomment, e.comment ecomment, ...
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Computerworld tilbyder specialiserede kurser i database-management

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester