473,386 Members | 1,698 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,386 software developers and data experts.

Fetch array values

65
Hi friends,

I'm having a table which stores id as comma separated in string datatype.
I want to fetch each of the value in a row in the form of array such as follows:

table:
sid name
2,3,5,7,9... Apple
19,37,46,1... Orange

What i need is,
array[0]=2 array[1]=3......

each comma separated value should be in separate array.

How can i do this either in php script or in mysql?
I tried it by explode() function of php. But didn't work properly...
Please, help me out.

Thanx n Regards
Yas....
Apr 4 '08 #1
1 2797
ronverdonk
4,258 Expert 4TB
You are doing PHP programming now for quite some time. And all you have to do is store each exploded entry in another entry to an array.[php]<?php
$string='2,3,5,7,9';
$a_arr=explode(',', $string);
$b_arr=array();
foreach($a_arr as $val)
$b_arr[]=array($val);
?>[/php]Ronald
Apr 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jeremy Moncho | last post by:
Hi guys, I am having a comprehension problem for which I cannot seem to find an answer (by banging my head on my keyboard.) I have the following code which yields no results. I expect one...
1
by: Ann | last post by:
Hello everyone, hope someone can help me with this. I have a SQL stored procedure that inserts a record into a table, creates a cursor to fetch the last record that was added to get the unique...
2
by: Bnc119 | last post by:
Hello, I have written a C# COM server that has a few methods and a property called DataItems that returns an ArrayList. During the course of execution the ArrayList gets populated with several...
7
by: asenthil | last post by:
Hai to all, this is senthil... i'm now working in the field of VC++... i want to connect a mysql database... just now tried to retrieve rows from a simple mysql database by using VC++ My...
1
by: angappan | last post by:
to fetch a list of rows and columns from xml and to store it in array and how to count the dynamic rows and columns ........ Help with code and explanations .... Iam very new to xml...
2
by: sruthini | last post by:
Hi, I am doing send some values(signup form::firstname,lastname,title,organization) to mail id using javamail at the same time it should store in database, my problem is how to fetch values from...
20
by: sruthini | last post by:
Hi, I am doing send some values(signup form::firstname,lastname,title,organization) to mail id using javamail at the same time it should store in database, my problem is how to fetch values from...
5
by: meeanji | last post by:
Dear friends, I am storing values in Array. My array looks like this:: balu 26 MCA gold -------------> first row of array ...
3
by: preethikuppusamy | last post by:
I have included banner images in an array and used settimeout fun to dislay it in my home page. Now i have included those banners in a table and now i have to fetch it from the table and include in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.