This is not what I would consider a critical question but it has been bugging me a little.
If I have a number of mysql queries that I drop directly into an array because there is only a single result. Doing so uses a line of code such as this
$reservation['customer']=mysql_fetch_assoc(mysql_query("SELECT * FROM customers WHERE id='".$reservation['customerid']."' LIMIT 1"));
This is great and works well and is a single line which helps keep my code clean. HOWEVER, I am concerned that mysql might get bogged down over time if I do not clear the result using mysql_free_result()
Enter the question. It seems only way to perform a mysql_free_result on the query above to use something like this.
$result=mysql_query("SELECT * FROM customers WHERE id='".$reservation['customerid']."'"); $reservation['customer']=mysql_fetch_assoc($result); mysql_free_result($result);
Is there a shorthand for this? It just seems like 3 lines of code where I should be able to do it in 1 or 2.