Re: Re: sorry...probably too easy
| From: | Jason Wong | Date: | Wed, 05 Dec 2001 19:39:52 +0000 |
| Subject: | Re: Re: sorry...probably too easy | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14829@lists.php.net to get a copy of this message | ||
On Thursday 06 December 2001 03:19, Matthew Crouch wrote:
> solved my own problem.
> if anyone else needs it, the function is substr($string, firstposition,
> number)
> http://www.devshed.com/Server_Side/PHP/StringTheory/page4.html
>
> Mateo The Db Guy wrote:
> > i'm fairly new to php, and thank you in advance for helping.
> > is there a function that will extract the first character from a mysql
> > result and put it into a variable?
> > the goal is to make one of these browse-by-alpha lists
> >
> > ABCDEFGHIJKLMNOPQRSTUVWXYZ
> > A
> > Adam
> > Alethea
> > Arnie
> > B
> > Billy
> > Buster
> > ...
> >
> > where all the names come from the mysql query, and the anchors are
> > automatically built where they need to be.
You can also use $mystring[0]. Example:
$me = "ABCDEFGHIJ";
echo $me[0] . "<br>";
echo $me[1] . "<br>";
echo $me[2] . "<br>";
echo $me[3] . "<br>";
echo $me[4] . "<br>";
echo $me[5] . "<br>";
echo $me[6] . "<br>";
echo $me[7] . "<br>";
regards
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Love is never asking why?
*/