note 16878 added to function.mysql-query
| From: | acloutier at agricom dot ca | Date: | Fri, 16 Nov 2001 20:03:06 +0000 |
| Subject: | note 16878 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20937@lists.php.net to get a copy of this message | ||
You can put multiple query with PHP && MySQL:
//initialise MySQL users variables
mysql_query("select @a:=0,@b:=0");
//select values of variables
mysql_query("select @a:=sum(rate), @b:=count(*) from ratetable where
rated_user_id='$id'");
//finally, select for result
$rate_id_select=mysql_query("select @c:=round(@a/@b) as effective_rate");
//..and result $rate_user=mysql_result($rate_id_select,0,"effective_rate");
...
echo $rate_user;
Alain Cloutier
webmaster@saguenay.cc
--
http://www.php.net/manual/en/function.mysql-query.php
http://master.php.net/manage/user-notes.php?action=edit+16878
http://master.php.net/manage/user-notes.php?action=delete+16878
http://master.php.net/manage/user-notes.php?action=reject+16878