Forum Moderators: coopster

Message Too Old, No Replies

getting an array of all items in a MYSQL TEXT column?

         

partha

12:45 am on Apr 20, 2005 (gmt 0)

10+ Year Member



I have a table in mysql with this column called 'keywords'.

in eah row, the keywords column consists of a set of words separated by spaces, ex: row1 keywords = 'stuff boing foo'.

row3's keywords column might contain SOME of the keywords that were in row1's keywords, and it might contain a few others too.

I want to query the table and get a php array of all the UNIQUE keywords in the entire table -- in other words I don't want to have any duplicates in the array.

jatar_k

12:48 am on Apr 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



because they are in TEXT cols I don't know how far you can get with mysql alone. You can definitely select and explode each column individually and then compare them as you go and build an array of uniques.

Is this something that will be called often or is it a once a day type thing?

partha

1:04 am on Apr 20, 2005 (gmt 0)

10+ Year Member



well I was going to do that every time a user views the page, but I guess that would create a noticeable slowdown in the page load speed.

maybe I could put some in my php for inserting a row and make it compare the new row's keywords to a AllKeywordsInTheTable list and then add any new keywords to AllKeywordsInTheTable

jd01

1:36 am on Apr 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use something similar to this on some of my pages...

Instead of using mysql to store the keyword list I use an external php file, then reference it from my pages.

To control which keywords are presented I use a loop. (Similar to returning actual results, but I only loop through a single col. or set of id's... I do not diplay any of the information from the db, just check to see which information it is, then display the keywords associated with the condition present.)

It takes a little work to set up and display the correct words, without ever repeating, but I serve over 500 pages of keywords and descriptions this way with no repeats...

I'll expand more if you think this might be something you want to try.

Justin