Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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>';
    
}
?>
Comment

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>';
    
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php force array keys trim 
Php :: spl_autoload_register 
Php :: wordpress php cpt get all taxonomy 
Php :: laravel passport get tokenId 
Php :: filter_var filter_validate_url 
Php :: laravel fortify 
Php :: download pdf php 
Php :: Get only time from timestamp in laravel 
Php :: php date set utc 
Php :: php artisan test 
Php :: laravel scss 
Php :: php if 
Php :: phone number validation, laravel 
Php :: redirect 404 in laravel 
Php :: php time to date 
Php :: how to sent request in php 
Php :: request file create cammand laravel 
Php :: laravel 8 404 status 
Php :: why storage link do not work in host for laravel 
Php :: Array to XML Conversion using PHP 
Php :: file_put_contents 
Php :: get ip address of client php 
Php :: name of today php 
Php :: php return function result to variable 
Php :: laravel wherein 
Php :: laravel @extends 
Php :: fetch method and class in codeigniter 
Php :: Laravel eloquent restore soft delete 
Php :: eloquent unique combination 
Php :: php http authentication 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =