Fetching Data from a Table
| From: | Ben Ocean | Date: | Wed, 28 Jun 2000 15:59:44 +0000 |
| Subject: | Fetching Data from a Table | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3587@lists.php.net to get a copy of this message | ||
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