Re: Seperate strings in PHP ARGH!
| From: | Sefton | Date: | Wed, 03 Jan 2001 03:54:45 +0000 |
| Subject: | Re: Seperate strings in PHP ARGH! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32460@lists.php.net to get a copy of this message | ||
I have had a chance to give the code below a try but it doesn't work.
++++++++++++++++++++++++++++++++
// I decided to go with a space ' ' instead of a comma , in mysql
// Hence the use of the space in the $feature line.
//$myrow[10] is the array used to aquire the information
//from the mysql database
echo "<table><tr><td>";
$feature = explode(' ',$myrow[10]);
foreach ($feature as $feature){
print '<img src="images/'.$feature.'.gif">';
}
echo "</table></tr></td>";
+++++++++++++++++++++++++++++++++
In the PHP manual it mentions something about a limit being added to php4.
My service provider is still using php3. Will this make a difference, if so,
how do i overcome it?
""Sefton"" <c.sefton@xtra.co.nz> wrote in message
news:92tak0$v9p$1@toye.p.sourceforge.net...
: 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
:
:
:
: --
: PHP General Mailing List (http://www.php.net/)
: To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
: For additional commands, e-mail: php-general-help@lists.php.net
: To contact the list administrators, e-mail: php-list-admin@lists.php.net
: