php - MySQLi fetch error -
i trying move mysql_query mysqli_query @ moment error:
warning: mysqli_fetch_array() expects parameter 1 mysqli_result, object given in
i searched google nothing helped me. maybe here able to!
this code:
connection:
$objconnect = mysqli_connect("localhost","konstyle","root", "konstyle") or die(mysqli_error()); sql query:
$objquery_category = mysqli_query($objconnect, $sql_category) or die ("error query [".$sql_category."]"); fetch array:
while($objresult = mysqli_fetch_array($objconnect, $objquery_category)) why getting error/warning?
you need lose $objconnect when fetching. should work:
while($objresult = mysqli_fetch_array($objquery_category)) this straight manual:
mixed mysqli_fetch_array ( mysqli_result $result [, int $resulttype = mysqli_both ] )
two arguments: 1st mysqli_result , optional result type.
the reason connection "saved" within $objquery_category after line: $objquery_category = mysqli_query($objconnect, $sql_category)
Comments
Post a Comment