0

my php code not executing correctly , i am echoing a category and it is echoing perfectly but when i am freeing my variable i am getting error saying mysqli_free_result() expects parameter 1 to be mysqli_result, null given ....

<li><a href="#" > <?php while($result3 = mysqli_fetch_array($row2)){ 
echo $result3['category'] ; } ?> </a></li>
<?php mysqli_free_result($result3) ; ?>   

and aditionally none of my php code below this is exectuing , its just returning no data (page source is giving no data )

what mistake am i doing ?

1
  • you should free the $row2 Commented Feb 4, 2015 at 13:26

3 Answers 3

2

instead of

<?php mysqli_free_result($result3) ; ?>  

do this

<?php mysqli_free_result($row2) ; ?>  
Sign up to request clarification or add additional context in comments.

Comments

0

Your mysqli_result should be the variable you are using to store the query. IE:

$result=mysqli_query($con,$sql);

You'd want to

mysqli_free_result($result);

By the looks of your code, you should free $row2

Comments

0

Remove extra statement from code and add it inside the loop

<li><a href="#" > 
  <?php while($result3 = mysqli_fetch_array($row2)){ 
       echo $result3['category'] ; 
       mysqli_free_result($row2) ;
   } ?> </a></li>   

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.