| 
	
 | 
 Posted by Lars Eighner on 07/16/07 06:23 
In our last episode,  
<1184544785.598523.147040@q75g2000hsh.googlegroups.com>,  
the lovely and talented rebeccatre@gmail.com  
broadcast on comp.lang.php: 
 
 
 
> Hello, could someone please show me how to do this. 
 
> In a single cell in a DB column, I can have multiple kinds of data 
> squeezed together delimited by a comma. 
 
> like ..... 
> "datagreen,datablue,dataorange,datawhite,datayellow,datared,datablue, ... 
> " 
 
Yes, you could do the same thing with a file-based data system.  The point 
of using a database is to avoid this sort of thing. 
 
> If I read that data and have it in a string like $datastring...... how 
> do I put it into a array situation? to access that data.... so if I 
> want to know what is in spot 5 only, and return back 'datayellow' for 
> instance, how do I do that? :-) I don't know if array is the right 
> word, I just want to be able to access any part of that string based 
> on the order it is in. 
 
The best stituation would have been to set up your database properly  
(1 cell = 1 datum).  As it is, you can use explode on the string which 
gives you a one-dimensional array, and the 5th item on the list will 
have index 4 in the array (because indices start at 0). 
 
> Thank you! 
 
> Rebecca 
 
--  
Lars Eighner     <http://larseighner.com/>     <http://myspace.com/larseighner> 
                         Countdown: 554 days to go. 
Owing to massive spam from googlegroups, I do not see most posts from there.
 
  
Navigation:
[Reply to this message] 
 |