teddy777 Posted March 24, 2009 Share Posted March 24, 2009 I get this when i fill out a form and submit it to my database. Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0. I've got my php code, this is my first one so its fairly crap. myusername=$_POST['myusername']; $password1=$_POST['password1']; $password2=$_POST['password2']; $myemailaddress=$_POST['email']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername'"; $result=mysql_query($sql); if($_POST['submit']){ //username checking if($myusername && strlen($myusername) >= 3){ $query = mysql_query("SELECT `id` FROM `tutreg` WHERE `username`='". $myusername."' LIMIT 1"); if(mysql_num_rows($query)){ $error['userexists'] = 'Username exists'; } } else { $error['usernameinput'] = 'Please enter a username of 3+ characters'; } //email checking if($myemailaddress){ if(!eregi("^[a-zA-Z0-9]+[a-zA-Z0-9_.-]*@[a-zA-Z0-9]+[a-zA-Z0-9_.-])*\.[a-z]{2,4}$", $myemailaddress)){ $error['emailerror'] = 'Email Incorrect'; } } else { $error['emailinput'] = 'Please supply an email address'; } //Password checking if($password1 && $password2){ if($password1 != $password2){ $error['passmismatch'] = 'Passwords don\'t match'; } } else { $error['passwordinput'] = 'Please enter your password in both fields'; } } if(!$error && $_POST['submit']){ $sql = mysql_query("INSERT INTO `tutreg` (username, password, email) VALUES ('".$myusername."', '".md5($password1)."', '".$myemailaddress."')"); if($query){ echo $myusername .' is now registered'; } } // Free memory mysql_free_result($result); ?> Quote Link to comment https://forums.phpfreaks.com/topic/150965-mysql-error-1-result-sets-not-freed/ Share on other sites More sharing options...
fenway Posted March 27, 2009 Share Posted March 27, 2009 Well, what about $query? Quote Link to comment https://forums.phpfreaks.com/topic/150965-mysql-error-1-result-sets-not-freed/#findComment-795309 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.