Date: 06/30/02
- Next message: Peter J. Schoenster: "Re: [PHP-DB] Storing passwords in a database"
- Previous message: Jason Wong: "Re: [PHP-DB] mail function"
- In reply to: CrossWalkCentral: "[PHP-DB] AVG fucntion help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Peter J. Schoenster: "Re: [PHP-DB] Storing passwords in a database"
- Previous message: Jason Wong: "Re: [PHP-DB] mail function"
- In reply to: CrossWalkCentral: "[PHP-DB] AVG fucntion help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

