473,396 Members | 2,010 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,396 software developers and data experts.

csv, array or alternative in mysql table?

im sort of a newbie to all of this and my terminology isnt accurate but
i have a couple simple questions. ive been looking around for a way to
insert multiple and seperate strings (like an array or a csv file)
inside of one row "cell" in a MySQL table. for examlpe id like to
insert "review1..., review2..., review3..., review4..." inside a row
"cell". id also like to be able to do a loop on them so i can format
each string. is it possible to insert an array into a "cell"? anyway,
if you could direct me in the right direction, i can figure the rest
out for MySELF. THANKS!

Jul 17 '05 #1
3 1991
kiqyou_vf wrote:
im sort of a newbie to all of this and my terminology isnt accurate but
i have a couple simple questions. ive been looking around for a way to
insert multiple and seperate strings (like an array or a csv file)
inside of one row "cell" in a MySQL table.
for examlpe id like to
insert "review1..., review2..., review3..., review4..." inside a row
"cell". id also like to be able to do a loop on them so i can format
each string. is it possible to insert an array into a "cell"? anyway,
if you could direct me in the right direction, i can figure the rest
out for MySELF. THANKS!


I have no idea about MySQL but Postgres does this. I'm guessing thats not
an option for you.

There are about a million reasons why you do not want to do this. The
normal approach is to create a second table and put each value into a row
in that table, something like this:

create table parent (
somekey char(10),
..other columns..)

create table child (
somekey char(10),
column1 char(10))

The idea is that the common column "somekey" links values from the child to
the parent.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Jul 17 '05 #2
i THINK i see what your sayin, each row on the child table is linked to
a certain column in the parent table?

Jul 17 '05 #3
kiqyou_vf wrote:
i THINK i see what your sayin, each row on the child table is linked to
a certain column in the parent table?


Yes, that's it. In PHP you can loop through these with code like the
following (assuming postgres, substitute mysql or whatever as appropriate):

$results = pg_query(
"select column1
from child
where somekey = '$valueofinterest'");
while ($row = pg_fetch_array($results) {
...do something with entry
}

Buy one of Celko's books on db design, or ask a lot of questions over in
comp.databases, it will really be a big help.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Linders | last post by:
Hi everyone. :-) Our site gets a ton of traffic on our contact forms, which collect the standard information (name, address, city, state, zip, home phone, etc.) The form validation is done with...
1
by: Raptor | last post by:
Hi, I'm quite new to MySQL and quite impressed by its feature set. I've also been looking at Interbase and it has a feature that allows a multidimensional array to be stored in a single field. ...
4
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to...
2
by: chrisoftoday | last post by:
Firstly, I know there's a lot of old posts on this topic but none seem to be relevant to my problem (selecting from a single table rather than several different tables)... I have a table with a...
5
by: Chris H | last post by:
Okay, I am trying to us a varialble with a list of number values as my data for an array, yet when I do this it doesnt return any values from the array, i was able to temporarily fix the proble by...
2
by: rjames.clarke | last post by:
I want to check if any of the items in a PHP array exist in a MySQL table. What is the best way to do this with making repeated calls to the database for each item? Actual application is: I...
8
by: kanwal | last post by:
Hi, I have millions of records in my xxxxx table in mysql. And I have a column of time in which I have stored the timestamp using php time() function. Now I wanna write an SQL query to fetch...
4
by: TechnoAtif | last post by:
Hi ALL I have entered some array values using checkboxes into mysql database through a form. Next iam creating a searchpage where all those cateogories inserted through checkboxes has to be...
2
by: mouac01 | last post by:
Let's say I have this MySQL table. Year Region Amount 2007 West 100 2007 East 200 2007 North 300 2007 South ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.