You are here: Re: Question about reading data I've created with , delimiter « All PHP « IT news, forums, messages
Re: Question about reading data I've created with , delimiter

Posted by Vince Morgan on 07/16/07 00:59

<?
$string='datagreen,datablue,dataetc';
$ary = explode($string, ',');
foreach($ary as $a)
{
echo "<p>".$a."</p>\t";
}
?>
explode() creates an array by breaking a string on deliminators (boundries).
Running the above in php should output what's below in the client browser.

datagreen
datablue
dataetc

HTH
Vince

<rebeccatre@gmail.com> wrote in message
news:1184544785.598523.147040@q75g2000hsh.googlegroups.com...
>
>
> 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, ...
> "
>
> 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.
>
> Thank you!
>
> Rebecca
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация