Re: select join table on mysql
| From: | Fred | Date: | Wed, 05 Dec 2001 16:10:28 +0000 |
| Subject: | Re: select join table on mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76735@lists.php.net to get a copy of this message | ||
The most common couse of this problem is that your query generated an mysql
error. To find out what the error is use this instead:
> $t2=mysql_db_query($db, "SELECT
radacct.UserName,sum(radacct.AcctSessionTime)
> as t1,usergroup.GroupName ".
> "from radacct LEFT JOIN usergroup ON
> radacct.UserName=usergroup.UserName where".
> "usergroup.GroupName='unlimited' AND
> radacct.AcctStartTime>='2001-$month-01 00:00:00'".
> "AND AcctStopTime<='2001-$month-31 23:59:59' group by UserName")
or die(mysql_error());
Yamin Prabudy <phplist@pro.net.id> wrote in message
news:php.general-76667@news.php.net...
> hi i have to select this :
>
> $t2=mysql_db_query($db, "SELECT
radacct.UserName,sum(radacct.AcctSessionTime)
> as t1,usergroup.GroupName ".
> "from radacct LEFT JOIN usergroup ON
> radacct.UserName=usergroup.UserName where".
> "usergroup.GroupName='unlimited' AND
> radacct.AcctStartTime>='2001-$month-01 00:00:00'".
> "AND AcctStopTime<='2001-$month-31 23:59:59' group by UserName");
>
>
>
> when i do it in mysql database it already give me result and thereis about
> 400 rows.
> but when i want to generate it fetch the array there is a error
> Supplied argument is not a valid MySQL result resource in
<b>./stats.php</b>
> on line (bellow is the line
>
> $x=mysql_fetch_array($t2);
>
>
> what might be possible wrong with the code..(it just a simple one)
>
>
> Yamin Prabudy