fetch row in php
$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result = $mysqli -> query($sql);
while ($row = $result -> fetch_row()) {
//statements
}
fetch row in php
$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result = $mysqli -> query($sql);
while ($row = $result -> fetch_row()) {
//statements
}
store fetched data into array php
<?php
$host='localhost';
$username='root';
$password='';
$conn=mysqli_connect($host,$username,$password,"student");
$category = mysqli_query($conn,"SELECT * FROM subcategory");
$category_id = [];
$i=0;
while($db_category = mysqli_fetch_array($category)) {
$category_id[]=$db_category["category_id"];
}
/* print_r($category_id); */
$category_name= mysqli_query($conn,"SELECT * FROM category where id IN ('" . implode("',' ",$category_id) . "')");
$i=0;
while($db_category_name = mysqli_fetch_array($category_name)) {
echo $db_category_name["category_name"].'<br>';
}
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us