php - Fatal error: Call to undefined function mysqli_result() -


can please tell me why doesnt work, when tried switch old sql sqli:

$query = "select * `product_category`"; $result = mysql_query($query, $connect) or die("could not perform query: " . mysql_error()); $num_rows = mysql_num_rows($result);  ($i=0; $i < $num_rows; $i++) {     $id = mysql_result($result,$i,"id");     $name = mysql_result($result,$i,"name");     $description = mysql_result($result,$i,"description"); 

to:

$query = ("select * `product_category`"); $result = mysqli_query($connect, $query) or die("could not perform query"); $num_rows = mysqli_num_rows($result);  ($i=0; $i < $num_rows; $i++) {     $id = mysqli_result($result, "id");     $name = mysqli_result($result,$i,"name");     $description = mysqli_result($result,$i,"description");` 

it keeps giving me error of: "fatal error: call undefined function mysqli_result()"

don't use kind of code. it's highly inefficient. use mysqli_fetch_assoc() instead:

while($row = mysqli_fetch_assoc($result)) {    $id = $row['id'];    $name = $row['name'];     etc.. } 

one single database operation, rather 3+ you're trying do.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -