473,839 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2009
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 = '$valueofintere st'");
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
3254
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 PHP. To eliminate (or at least deter) people wasting time submitting phony information, we can compare the state to the zip code (one DB table) and the zip code to the area code (another table in same DB).
1
8379
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. Does MySQL also have this feature? I was thinking about using MySQLs GIS data types but it only supports a two dimensional point, where as I need a three dimensional point to be stored. Each point represents a radar point. If anybody can...
4
5037
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 do it? I can bind data to datagrids and lists and stuff all day long, but can't seem to grasp this one. Any pointers to a useful article / demo (or just any useful pointers!) would be much appreciated. Thanks,
2
2497
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 user identifier (uID) and a movie identifier (movID) and need to select the movie identifiers that appear in the table for uID-1 but not for uID-2, using an alternative to NOT IN as it isn't supported by the version of MySQL that I'm using. I'd...
5
1475
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 just doing s normal array setup in my function, but the problem is I want the ability to have teh array values to be changed easily in a varibale style config/include file... Here is the code i am working with... ...
2
2922
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 have an array (in PHP) of serial numbers of units about to be shipped. I want to check the ship record (a table in a MySQL database) to check if that serial number has been used before.
8
2088
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 the records either for year (2006) or for month and year (Jan 2006) Currently I had implement this logic:
4
6504
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 retrieved using list/menu box. When i check only a single checkbox to insert the checked category ,selecting that category through list box gives out the entire data of the user corresponding to that category. However when i check multiple checkboxes and...
2
14505
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 400 2008 West 500 2008 East 600 2008 North 700
0
9856
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10910
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10654
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10297
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7833
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4066
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.