TapeGun007 Posted July 30, 2015 Share Posted July 30, 2015 I have a typical prepared mySQLi statement that runs just fine for example: ... $stmt = $con->prepare($sql); if($stmt === false){ trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $con->error, E_USER_ERROR); } $stmt->bind_param("s",$Username); $stmt->execute(); $stmt->bind_result( ** Variables here** ); $stmt->fetch(); $stmt->close(); This all works fine. Now I want to make another mySQLi call using a function basically. The function works FINE in a test file with no other mySQLi calls in it. For sake of ease, just assume this was actually in the code after the above. $sql="INSERT INTO LoginAttempts (LASalesID) VALUES ('$ID')"; if ($con->query($sql) === TRUE) { echo "New record created successfully"; } else { // Report the Error echo "Error: " . $sql . "<br>" . mysqli_error($con); } I'm getting the Error message every time. Am I not closing out the initial calls correctly and freeing up resources? Quote Link to comment Share on other sites More sharing options...
Solution Zane Posted July 30, 2015 Solution Share Posted July 30, 2015 Probably because you are closing the connection before hand Quote Link to comment Share on other sites More sharing options...
TapeGun007 Posted July 30, 2015 Author Share Posted July 30, 2015 (edited) LOL. I can't believe it was that simple. Yeah, I had $con->close; in there. Edited July 30, 2015 by TapeGun007 Quote Link to comment 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.