NYCPHP Meetup

NYPHP.org

[nycphp-talk] freeing sql results

jface at mercenarylabs.com jface at mercenarylabs.com
Thu Dec 7 23:39:41 EST 2006


I did include "or die()"s, just neglected to put them into the email. No SQL syntax errors come back. 
The only kinds of errors I'm getting are that sql results are not being freed.
Tried passing the SQL into mysql_query as a separate string, too. No luck.

On Thu, 07 Dec 2006 22:34:04 -0500, Ken Robinson <kenrbnsn at rbnsn.com> wrote:
> At 10:58 PM 12/7/2006, jface at mercenarylabs.com wrote:
>>After a lot of trial and error I've narrowed down the offending
>>query in my problem with sql results not freeing themselves up:
>>
>>$query = mysql_query("SELECT activeID FROM activeAI WHERE
>>locationID='$locationID' AND activeID <> '$activeID' AND isUndead=0");
>>$numOtherAI = mysql_num_rows($query);
>>mysql_free_result($query);
>>
>>When I comment out this query, the error(s) go away. Variables
>>$locationID and $activeID are both properly set.
> 
> You really should check for errors when doing a mysql_query. Putting
> the query in a separate string helps.
> 
> $q = "SELECT activeID FROM activeAI WHERE locationID='$locationID'
> AND activeID <> '$activeID' AND isUndead=0";
> $rs = mysql_query($q) or die("Problem with the query: $q<br>" .
> mysql_error());
> $numOtherAl = mysql_num_rows($rs);
> mysql_free_result($rs);
> 
> Ken
> 
> 
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
> 
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list