Syntac wrote:Your code is a bit screwy. mysql_connect() actually returns a database resource. This resource is the variable that must be passed to mysql_close(), not the result of mysql_query().
actually, it's only true if he is opening multiple connections to the server, as mysql_close by itself will close the last opened connection (in this case, since there is only one, it is the one connection he has opened). This means that if there is only one connection, it is
not required for a resource identifier to be passed in this case.
The thing that mmj was pointing out is mysql_close($result);
You don't need $result inside of mysql_close as it is not a valid identifier. take it out and leave it blank so that you just have mysql_close();
To go further though, you don' t even need mysql_close unless you are using persistent connections as php closes the connection for you. If you are using persistent connections, then yes you will need to close the connection manually.