title: How to echo a value from another table inner joined with the current table
body: <p>I have a simple problem that I couldn't get my head around it 
  the problem is I'm trying to echo a value from <strong>status</strong> table inner joined with the current table <em><code>user_asset</code></em> by status's id <em><code>s_id</code></em> </p>
  
  <p>I want to echo the name of the status but it keeps showing me this error</p>
  
  <blockquote>
    <p>Notice: Undefined index: stat in D:\wamp64\www\Caprabia-test\admin.php
    on line 104 </p>
  </blockquote>
  
  <pre><code>=============================================
  |                user_asset                 |
  =============================================
  | id | category | code | userid | status_id | 
  =============================================
  
  ====================
  |   status table   |
  ====================
  | s_id | stat_name |
  ====================
  
  ===========================
  |   category table        |
  ===========================
  | category_id | cate_name |
  ===========================
  
  =============================================================================
  |                                  user                                     |
  =============================================================================
  | user_id | first_name | last_name | email | password | dept | user_type_id |
  =============================================================================
  </code></pre>
  
  <p>Here is my <strong>php code</strong> :</p>
  
  <pre><code>$result = mysqli_query(
      $conn, 
      "select 
           user_asset.*, 
           user.first_name as fname, 
           user.last_name as lname,
           user.user_id, 
           user.dept,
           category.cate_name as titlecat, 
           status.stat_name as stat 
      from user_asset     
      inner join category on user_asset.asset_category = category.category_id     
      inner join user on user_asset.userid = user.user_id 
      inner join status on user_asset.status_id = status.s_id"
  );
  </code></pre>
  
  <p>and <strong>my table</strong> :</p>
  
  <pre><code>&lt;table cellpadding="0" cellspacing="0" border="0" class="datatable-1 table table-bordered table-striped  display " width="100%"&gt;
      &lt;thead&gt;
          &lt;tr &gt;
              &lt;th style="text-align:center"&gt; الرقم &lt;/th&gt;
              &lt;th style="text-align:center"&gt;المستخدم&lt;/th&gt;
              &lt;th style="text-align:center"&gt;القسم&lt;/th&gt;
              &lt;th style="text-align:center"&gt;الصنف&lt;/th&gt;
              &lt;th style="text-align:center"&gt;الكود&lt;/th&gt;
              &lt;th style="text-align:center"&gt;التفاصيل&lt;/th&gt;
              &lt;th style="text-align:center"&gt;الحالة&lt;/th&gt;
              &lt;th style="text-align:center"&gt;لاعدادات &lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
  
      &lt;?php 
      $no = 1;
      while($row = mysqli_fetch_array($result)){
      ?&gt;
  
          &lt;tr&gt;
              &lt;td style="text-align:center"&gt;&lt;?php echo $no;?&gt;&lt;/td&gt;
              &lt;td style="text-align:center"&gt;
                  &lt;a href="/Caprabia-test/view_user.php?id=&lt;?php echo $row['user_id'];?&gt;"&gt;
                      &lt;?php echo $row['fname'];?&gt;  &lt;?php echo $row['lname'];?&gt; 
                  &lt;/a&gt;
              &lt;/td&gt;
              &lt;td style="text-align:center"&gt;&lt;?php echo $row['dept'];?&gt;&lt;/td&gt;
              &lt;td style="text-align:center"&gt;&lt;?php echo $row['titlecat'];?&gt;&lt;/td&gt;
              &lt;td style="text-align:center"&gt;&lt;?php echo $row['code'];?&gt;&lt;/td&gt;
              &lt;td style="text-align:center"&gt;&lt;?php echo $row['title'];?&gt;&lt;/td&gt;
              &lt;td style="text-align:center"&gt;&lt;?php echo $row['stat'];?&gt;&lt;/td&gt;
              &lt;td class="center" style="text-align:center"&gt;
                  &lt;a class="" href="edit_asset.php?idedit=&lt;?php echo $row['asset_id'];?&gt;" data-toggle="tooltip" title=" تعديل الاصل" &gt; 
                      &lt;i class="icon-edit"&gt; &lt;/i&gt;
                  &lt;/a&gt;
                  &lt;br&gt;
                  &lt;a class=""href="move_asset.php?idmove=&lt;?php echo $row['asset_id']?&gt;" data-toggle="tooltip" title="نقل الأصل الى مستخدم اخر"&gt; 
                      &lt;i class="icon-move"&gt; &lt;/i&gt;
                  &lt;/a&gt;
                  &lt;br&gt;
                  &lt;a class="" href="admin.php?idedelete=&lt;?php echo $row['asset_id'] ?&gt;"  onclick= "return checkDelete()" data-toggle="tooltip" title="ارشفة الاصل"&gt; 
                      &lt;i class="icon-trash"&gt; &lt;/i&gt;
                  &lt;/a&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;?php $no++; ?&gt;
      &lt;?php }?&gt;
  
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The output of <code>var_dump($row)</code> :</p>
  
  <pre><code>array (size=22)
      0 =&gt; string '1210' (length=4)
      'asset_id' =&gt; string '1210' (length=4)
      1 =&gt; string '9' (length=1)
      'asset_category' =&gt; string '9' (length=1)
      2 =&gt; string '564' (length=3)
      'code' =&gt; string '564' (length=3)
      3 =&gt; string 'ىلاةةيلاةلا' (length=22)
      'title' =&gt; string 'ىلاةةيلاةلا' (length=22)
      4 =&gt; string '19001' (length=5)
      'userid' =&gt; string '19001' (length=5)
      5 =&gt; string '1' (length=1)
      'status_id' =&gt; string '1' (length=1)
      6 =&gt; string 'احمد' (length=8)
      'fname' =&gt; string 'احمد' (length=8)
      7 =&gt; string 'نور' (length=6)
      'lname' =&gt; string 'نور' (length=6)
      8 =&gt; string '19001' (length=5)
      'user_id' =&gt; string '19001' (length=5)
      9 =&gt; string 'تقنية المعلومات' (length=29)
      'dept' =&gt; string 'تقنية المعلومات' (length=29)
      10 =&gt; string 'أجهزة كهربائية' (length=27)
      'titlecat' =&gt; string 'أجهزة كهربائية' (length=27)
  </code></pre>