472,353 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 1941
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,...
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...
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...
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...
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...
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...
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()...
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...
2
by: mouac01 | last post by:
Let's say I have this MySQL table. Year Region Amount 2007 West 100 2007 East 200 2007 ...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.