On Sunday 30 June 2002 03:15, CrossWalkCentral wrote:
> Using PHP
>
> I need some help running and AVG qery
>
> the syntax is as follows
>
> $results=sql_query("Select AVG(rate) from MYTABLENAME where id=$id",$dbi)
>
> This works but I am not sure how to get is value into a variable.
Assuming your query is correct, use:
$results=sql_query("Select AVG(rate) AS average from MYTABLENAME where
id=$id",$dbi);
This creates a column (field) called 'average' which you can extract using
whatever db query code you usually use.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
The power to destroy a planet is insignificant when compared to the power of
the Force.
- Darth Vader
*/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php