deadliver Posted October 26, 2012 Share Posted October 26, 2012 Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in on line 78 This is my first time using MYSQLI and i followed and example I found on procedural coding and it always returns this error. I looked on the php manual online and their examples seem to be coded like this as well. Does anyone know how I can correct this issue? I connect to the db successfully. $link = mysqli_connect(DB_HOST, DB_USER,DB_PASS,DB_NAME); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } Then I make the INSERT statement and run the query successfully $players_query = "INSERT INTO `players` (id_players,player_name,player_id,clan_id,created_at,clan_name,clan_role,clan_member_since,data_updated_at) VALUES ('','$player_name',$player_id,$clan_id,$created_at,'$clan_name','$clan_role',$clan_member_since,$updated_at) ON DUPLICATE KEY UPDATE clan_id =$clan_id ,clan_role = '$clan_role',data_updated_at =$updated_at"; $result = mysqli_query($link,$players_query); Then I verify the query ran and try to free results before the next query. if($result){ echo "Player Information Updated Successfully"; mysqli_free_result($result); }else{ printf("Errormessage: %s\n", mysqli_error($link)); die(); } Then I get this: Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in on line 78 Link to comment https://forums.phpfreaks.com/topic/269960-mysqli_free_result-expects-parameter-1-to-be-mysqli_result/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 26, 2012 Share Posted October 26, 2012 An INSERT query does not return a result set, so there's nothing to free up. Only SELECT, SHOW, and EXPLAIN queries return a result set. Link to comment https://forums.phpfreaks.com/topic/269960-mysqli_free_result-expects-parameter-1-to-be-mysqli_result/#findComment-1388056 Share on other sites More sharing options...
deadliver Posted October 27, 2012 Author Share Posted October 27, 2012 Thank you so much. Link to comment https://forums.phpfreaks.com/topic/269960-mysqli_free_result-expects-parameter-1-to-be-mysqli_result/#findComment-1388057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.