[thelist] php/mySQL again - getting single result from query?

Burhan Khalid thelist at meidomus.com
Sat Jun 12 02:37:00 CDT 2004


Tom Dell'Aringa wrote:

> As you can see, I'm having my php/mySQL troubles today - I'm way too
> rusty! I have a simple query that is going to produce a single
> result, a number. I can't seem to remember how to pull it. I'm doing
> this:
> 
> $queryD = "select sum(teamAID) as gp 
> from games where teamAID = '$teamID'";
>   $gamesResult = mysql_query($queryD);
>   $losses = $gamesResult["gamesPlayed"];
> 
if (!$tmp = mysql_fetch_assoc($gamesResult)) { die($queryD."<br 
/>".mysql_error()); }
$losses = $tmp['gp'];

Cheers,
Burhan


More information about the thelist mailing list