Seperate strings in PHP
| From: | Sefton | Date: | Mon, 01 Jan 2001 04:25:36 +0000 |
| Subject: | Seperate strings in PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32290@lists.php.net to get a copy of this message | ||
Hello Everybody,
Happy New Year !!!
I have a question that to the skilled is probably very basic.
Within a mysql database I have a field that holds the following type of
information...
ac,pw,ps,rc,cd,aw,rs,4wd,abs etc
It is the features of a car, and the field name is "specs" (Eg ac = air
conditioning, pw = power steer etc)
I don't want an indivual field for all the different features, but I want to
be able to break up the above string and place an image in my page for that
abreviation. I have the rest sorted out the vehicle make model etc I just
need to display these. I already have the images (eg: ac.gif)
Different vehicles will have different numbers of specs. Some might only
have ac,pw,ps.
Example
I would like the above string to appear something like...
echo "<img src=\"images/$myrow[10].gif\">";
I am not sure how to continue it. Let alone split the string. I assume
converting the string to an array would work, but I am not sure how. Is
there an opposite to the implode command where I could specify the "," as a
break?
Any help would be really great.
Thanks,
Chris