0

I am making a table on bootstrap fetching data in this table from two table in same database here is picture of my database select two table fron on database

here is my code i am using to fetch value from databases

 <table class="table table-hover table-striped">
                                        <thead>
                                            <tr>
                                                <th>Id</th>
                                                <th>File-name</th>
                                                <th>Purpose</th>
                                                <th>Recieved-By </th>
                                                 <th>Processed-By</th>
                                                 <th>Address</th>
                                                 <th>Contact-No</th>
                                                 <th>Recieved-Date</th>
                                                 <th>Update-date</th>
                                                 <th>status</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                        <?php
                          $p_query= "SELECT id, file_name, recieved_by, processed_by, purpose, address, contact_no, date,update_date,reason FROM files INNER JOIN update_table ON files.id=update_table.id"; 
                          $con=mysqli_connect("localhost","root","","fileprogramsysteeem");
                          $p_run=mysqli_query($con,$p_query);
                            if(mysqli_num_rows($p_run)){
                             while($row=mysqli_fetch_array($p_run))
                             {
                                $id=$row['id'];
                                $file=$row['file_name'];
                                $purpose=$row['purpose'];
                                $recieve=$row['recieved_by'];
                                $processed=$row['processed_by'];
                                $address=$row['address'];
                                $contact=$row['contact_no'];
                                $date=$row['date'];
                                $up_date=$row['update_date'];
                                $status=$row['reason'];


                            ?>
                                            <tr>

                                                 <td><a  href="post.php?post_id=<?php echo $id?>"><?php echo $id;?></a></td>
                                                 <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $file;?></a></td>
                                                 <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $purpose;?></a></td>
                                                <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $recieve;?></a></td>
                                                <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $processed;?></a></td>
                                                <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $address;?></a></td>
                                                <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $contact;?></a></td>
                                                <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $date;?></a></td>
                                                <td><a href="post.php?post_id=<?php echo $id?>"><?php echo $up_date;?></a></td>
                                                <td style="color:#337AB7;"><?php echo $id?>"><?php echo $status;?></td>
                                            </tr>
                                            <?php 
                                      }
                                    }
                                   ?>
                                        </tbody>
                                    </table>

Now after applying this code i am getting this error :

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result

I have to select file_name, received _by, processed_by, purpose, address, contact_no, date from table files and update_date , reason from table update_table

Raj
  • 151
  • 1
  • 11
  • 1
    first read all my code then please try to answer it , and please clear your answer and thank you for taking interest – Raj Oct 27 '17 at 07:41
  • No. First of all you please make the minimal effort to research the error message, so that you a) know what causes it, and b) what steps to undertake next to get a more detailed error message from the database. https://stackoverflow.com/a/2973209/1427878 explains how to ask the database for the actual error cause. – CBroe Oct 27 '17 at 08:02
  • Sir i had check all possible answer for my error , but i am not getting answer . just only tell me , is there any problem with my select query – Raj Oct 27 '17 at 09:16
  • _“Sir i had check all possible answer for my error , but i am not getting answer .”_ - so you have not understood anything of what was explained to you there? Well then what sense is it going to make, if I just explain the same thing again now? _“ just only tell me , is there any problem with my select query”_ - Yes. Again: Go read up on how you get the database to tell you what the actual error is. Implement that, and then come back here, and show us the MySQL error message. – CBroe Oct 27 '17 at 12:57

1 Answers1

1
$p_query= "SELECT files.* , update_table.* FROM files INNER JOIN update_table ON files.id=update_table.id"; 
                      $con=mysqli_connect("localhost","root","","fileprogramsysteeem");

try this may be this would help

vikash
  • 176
  • 8