Search
 
SCRIPT & CODE EXAMPLE
 

PHP

selecting data from two tables in database php

<?php  
 $connect = mysqli_connect("localhost", "root", "", "zzz");  
 $sql = "SELECT * FROM brand INNER JOIN product ON brand.brand_id = product.brand_id";  
 $result = mysqli_query($connect, $sql);  
 ?>  
 <!DOCTYPE html>  
 <html>  
      <head>  
           <title>Webslesson Tutorial | Fetch Data from Two or more Table Join using PHP and MySql</title>  
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>  
           <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />  
           <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  
      </head>  
      <body>  
           <br />  
           <div class="container" style="width:500px;">  
                <h3 align="">Fetch Data from Two or more Table Join using PHP and MySql</h3><br />                 
                <div class="table-responsive">  
                     <table class="table table-striped">  
                          <tr>  
                               <th>Brand Name</th>  
                               <th>Product Name</th>  
                          </tr>  
                          <?php  
                          if(mysqli_num_rows($result) > 0)  
                          {  
                               while($row = mysqli_fetch_array($result))  
                               {  
                          ?>  
                          <tr>  
                               <td><?php echo $row["brand_name"];?></td>  
                               <td><?php echo $row["product_name"]; ?></td>  
                          </tr>  
                          <?php  
                               }  
                          }  
                          ?>  
                     </table>  
                </div>  
           </div>  
           <br />  
      </body>  
 </html>
Comment

selecting data from two tables in database php

SELECT tbl_a.column1 , tbl_a.column2
       tbl_b.column1 , tbl_b.column2
FROM   tbl_a INNER JOIN tbl_b
ON     tbl_a.commonfield=tbl_b.commonfield
Comment

PREVIOUS NEXT
Code Example
Php :: laravel add many to many 
Php :: laravel collection pop 
Php :: where to add browscap php 
Php :: square root 
Php :: Laravel get all parent categories for each category 
Php :: php class instance 
Php :: wp_delete_attachment unlink 
Php :: set config key dynamic laravel 
Php :: @yield laravel 
Php :: PHP exif_read_data() 
Php :: $wpdb foreach 
Php :: php get error 
Php :: foreach loop in php stack overflow 
Php :: laravel remove controller 
Php :: php Convert multidimensional array into single array 
Php :: how to use or where in laravel 
Php :: wordpress shortcode api 
Php :: array_diff php 
Php :: server.php not found 
Php :: PHP OOP - Inheritance 
Php :: laravel 8 php version requirements 
Php :: closure in php 
Php :: add column migration laravel 8 
Php :: laravel blade @if 3 varabile 
Php :: php get variable name as a string 
Php :: php session 
Php :: laravel package console command 
Php :: laravel with select 
Php :: download html table to excel 
Php :: notification in laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =