I have a php script that runs a mysql query, then loops the result, and in that loop also runs several queries:
$sqlstr = \"SELECT * FROM user_pred WHERE
I think you should try calling mysql_free_result() at some point during the loop. — From the comments:
It's worth noting that mysql_query() only returns a resource for
SELECT
,SHOW
,EXPLAIN
, andDESCRIBE
queries.
So there is no result to free for an update query.
Anyway, your approach is not the best to begin with. Try mysqli paramterized statements instead, or (even better) updating the rows at the database directly. It looks like all of the SQL in the loop could be handled with one single UPDATE statement.