Pete wrote: > > > In message <[EMAIL PROTECTED] > <mailto:6930a4490808202319i3e083eag42429100c0482a2d%40mail.gmail.com>>, > Martinus Hadiwinata <[EMAIL PROTECTED] > <mailto:martinus.ardian%40gmail.com>> writes > >Hi Guys, > > > >I got this warning on several page: > >*Warning*: mysql_free_result(): 25 is not a valid MySQL result resource > > > >Does anyone know how to get rid this warning message that appears on a > page > >without using error_reporting() function? > > > >I have checked my syntax and they seem fine and correct. Moreover, the > page > >displays the items as it should be. > > As it would do, since free result would come after displaying the data. > > Suggestions > > 1) Don't use it <G> it isn't usually necessary, unless you are > returning huge datasets, as the memory is freed when the script ends, if > you are not using persistent connections. > > 2) You should be feeding it with the variable which you get from your > query > $result = mysql_query("SELECT * FROM everything"); > ... > mysql_free_result($result) > > and $result won't contain 25, which is what you get in your error > message. It should be a resource, not a number. > > -- > Pete Clark
<rant> Come on Pete, "don't use it" is a terrible answer. True, you may not need the mysql_free_result in some cases but the only way to better learn PHP is to debug, not to throw out useful code because it causes an error. </rant> To answer the original question, there are a couple things off the top of my head that will cause this. 1. You have closed the mysql connection. "mysql_close();" 2. You have not given the mysql_free_result the correct query handle. Your code should look something like this: $db = mysql_connect('server','user','pass); $q = mysql_query('select * from wherever',$db); -- some code here to do something with your result --- mysql_free_result($q); bp