The STEEM WATCHER Detectives Reporting Portal (SW Portal) -- Fetch Data From Database -- 23/12/2022

in Steem Devlast year (edited)

902C87F7-F8D1-440D-8F21-FCA7A995E1EA.png

Hello everyone!

How are you all? I hope my friends will be happy and well. by the grace of God, I am also well. Today I am here with new development of SW portal. In the last post SW portal, I've discussed my working on report adding to the database of SW portal as well as the backend behaviour of ADD reports.

Today i will share the development of fetching reports data from database and show it on the SW portal. i will also discuss the backend working behavior of it. first of all, we will a report and experience that how it will show on the portal then i will move on next part. Multiple languages are using in this project. These langauges are HTML, CSS, bootstrap, JavaScript, PHP and SQL language. Many types of condition are applied to stop the junk and dummy reports to database.

The hardest phase to handle is role-level security. It is the database concept that I will share in the next development post. First, our focus is on entering and fetching the data from the database. So let's start and add a random report.

Screenshot_17.png

Report added and message has been popup.

Screenshot_18.png

Now, open the Report Section, and you will see that the new report has been successfully populated. as shown in the screenshot below. After the role-level security phase is completed, the website will go live, and all reports will be published and available for viewing on the SW Portal.

Screenshot_19.png

Post Link and Source Column are the columns that can be clicked. The link will open in a new window after you click on it. I've never used this feature before, therefore it's quite challenging for me to open the link in a new tab. Since last week, I've been trying to figure out how to include it best.

A new column named Action is added in the report. the perpose of these colum is to edit and delete the report. Development of on this function is not completed yet. i will complete guide about it when it will completed.

Screenshot_20.png

PHP Code for report fetching from Database.

        <?php
        $conn = new mysqli($servername,$username,$password,$dbname);
          if ($conn -> connect_errno){
         echo "Failed to connect to MySQL: " . $conn -> connect_error;
             exit(); }

             $sql =  "SELECT * FROM `swatcher`;";
               $result = ($conn->query($sql));
    
                          $row = [];

                           if ($result->num_rows > 0){
                       $row = $result->fetch_all(MYSQLI_ASSOC); }      ?>

                       <?php 
                       if(!empty($row))
            foreach($row as $rows)
            {?>
            <tr>
                <td><?php echo $rows['ID']; ?></td>
                <td><?php echo $rows['U_ID']; ?></td>
                <td><?php echo "<a href='" .$rows['P_LINK']."'target=_blank>" .$rows['P_LINK'].  "</a>"   ?></td>
                <td><?php echo "<a href='" .$rows['S_LINK']. "'target=_blank>" . $rows['S_LINK'] . "</a>"?></td>
                <td><?php echo $rows['C_BY']; ?></td>
                <td><?php echo $rows['P_TYPE']; ?></td>
                                           </tr>
            <?php } ?>


BoC- line.png

if you have any suggestion then must share with us in the comment section. we will focus on it and try to apply it if it will suitable.


Thanks for giving your precious time to my post.

Follow | Upvote | Share | Comments

Special Thanks to

Cc: @rme
Cc: @hungry-griffin
Cc: @blacks

Follow me on Instagram.
Instagram

🆃🅷🅰️🅽🅺 🆈🅾️🆄

Sort:  

Congratulations, your post has been upvoted by @dsc-r2cornell, which is the curating account for @R2cornell's Discord Community.

Manually curated by @jasonmunapasee

r2cornell_curation_banner.png

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.032
BTC 63617.36
ETH 3070.79
USDT 1.00
SBD 3.82