我想从第一个表中获取数据然后再次需要使用第一个表从另一个表中获取第二个数据,其中value [关闭]

I have 3 tables, 1). mobile, 2). store1, 3). store2 Fetching from table "mobile" then we received 4 rows of record from table. then i am fetching this row to store1 and store2 for other details.

Please suggest me what i need to do.

<?php
$mysqli = new mysqli("host" , "user" , "pass" , "database");
$result = $mysqli->query( "SELECT * FROM mobile WHERE live= '1' ") ;
while ( $rows =  $result->fetch_assoc() ) {

$store = $rows["store"];
$productId = $rows["productId"];
$store2 = $rows["store2"];
$productId2 = $rows["productId2"];

php?>

<?php
$result = $mysqli->query( "SELECT * FROM $store where productId='$productId' ") ;
while ( $rows =  $result->fetch_assoc() ) {

$title = $rows["title"];

$productImage = explode (",", $rows['imageUrlStr']);
$mrpPrice = explode (",", $rows['mrp']);
$offerPrice = explode (",", $rows['price']);
}

$result = $mysqli->query( "SELECT * FROM $store2 where productId= '$productId2'  ") ;
while ( $rows =  $result->fetch_assoc() ) {

$title2 = $rows["title"];

$productImage2 = explode (",", $rows['imageUrlStr']);
$mrpPrice2 = explode (",", $rows['mrp']);
$offerPrice2 = explode (",", $rows['price']);
} ?>

    <li class="mobile-box als-item">
        <div class="mobile-box-top">
            <div class="mobile-box-top-img"><img src="<?php echo $productImage[5]; ?>" alt="" title="" /></div>
            <div class="mobile-box-top-txt"><?php echo $title; ?></div>
            <div class="mobile-box-top-tag"><i class="fa fa-inr"></i> <?php echo $offerPrice[0]; ?></div>
        </div>
        <div class="mobile-box-bottom border-bottom">
            <div class="mobile-box-bottom-img"><img src="<?php echo $productImage2[5]; ?>" alt="" title="" /></div>
            <div class="mobile-box-bottom-txt"><?php echo $title2; ?></div>
            <div class="mobile-box-bottom-tag"><i class="fa fa-inr"></i> <?php echo $offerPrice2[0]; ?></div>
        </div>
        <div class="mobile-box-button"><a href="">Compare Now</a></div>
    </li>

you have to do in this way

step 1 : try to fetch the query like this as you are take the data in result

so try to make like this

$result1 = $mysqli->query( "SELECT * FROM $store where  productId= $result.productId ") ;

same for the table two