TUTORIAL PHP

PHP - Environment Setup


ini content environtment

 

<!-- Sidebar/menu -->
<nav class="w3-sidebar w3-light-grey w3-collapse w3-top" style="z-index:3;width:260px" id="mySidebar">
<div class="w3-container w3-display-container w3-padding-16">
<i onclick="w3_close()" class="fa fa-remove w3-hide-large w3-button w3-transparent w3-display-topright"></i>
<div style="margin:0 auto;">
<div style="font-size:30px;">W3.</div>
<a href="<?php echo base_url();?>"><img src="<?php echo base_url('set')?>/logo.png" style="height:90px;margin-left:30px;"></a>
</div>
</div>

<div class="w3-bar-block">
<?php 
// buat koneksi dengan MySQL, gunakan database: universitas
$link = mysqli_connect("localhost", "root", "", "adsense");
 
// jalankan query
 
// tampilkan query


$result = mysqli_query($link, "SELECT * FROM category");
while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC))
{
            ?>
<div class="title"><?php echo $row['name_category'];?></div>
<ul>
<?php
$id = $row['id_category'];
$result1 = mysqli_query($link, "SELECT * FROM content WHERE category_content='$id'");
while($data=mysqli_fetch_array($result1,MYSQLI_ASSOC))
{
            ?>
<li><a href="<?php echo $data['slug_content'].".html";?>"><?php echo $data['title_content'];?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>
</nav>