Re: Fetching Data from a Table
| From: | Matthew Leverton | Date: | Wed, 28 Jun 2000 16:03:24 +0000 |
| Subject: | Re: Fetching Data from a Table | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3590@lists.php.net to get a copy of this message | ||
Try using substr() instead of subst();
You could also use a regular expression like:
"[0-9]{4}-[0-9]{2}-[0-9]{2}"
and place them into an array
--
Matthew Leverton - matthew@aeroinc.net -
http://depot.allegro.cc
-----Original Message-----
From: Ben Ocean <beno@cnw.com>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Wednesday, June 28, 2000 11:00 AM
Subject: [PHP] Fetching Data from a Table
>Hi;
>I'm trying to parse birthdata from a string in a table (in form YYY-MM-DD).
>I'm using this expression to fetch the data from a table called *horse*:
>
>$query = "select name, color, gender, birth from horse order by color";
>$result = mysql_query ($query)
>or die ("Query failed");
>
>then cycling through the data thus:
>
>while ($row = mysql_fetch_row ($result))
>{
>for ($i = 0; $i < mysql_num_fields ($result); $i++)
>{
>
>and now here's the problem area: trying to parse the birthdate
>
>$birthyr = subst($row[birth],0,4); /* calc year of birth */
>$birthmo = subst($row[birth],5,2); /* calc mo. of birth */
>$birthda = subst($row[birth],8,2); /* calc day of birth */
>
>I get this error message:
>
>Fatal error: Call to unsupported or undefined function subst() in
>/usr/www/thewebso/httpd/htdocs//Clients/Antigo/Antigo_search.php3 on line
77
>
>line 77 contains $birthyr = subst($row[birth],0,4);
>Thanks in advance for any help!
>BenO
>
>
>--
>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
>