NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<title>Hello, world!</title>
</head>
<?php
include('connectDB.php');

$sql = "select * from student natural join major order by student_id";

if( !$result = $db->query($sql)){
die( $db->error );
}

$numRows = $result->num_rows;

$perPage = 3;
$totalPage = ceil($numRows/$perPage);

if( !isset($_GET['page'])){
$page = 1;
}
else{$page = $_GET['page'];}



$startLimit = ($page-1) * $perPage;

$sql .= " limit $startLimit,$perPage";
/* $sql = $sql . " limit 0,3 " */

if( !$result = $db->query($sql)){
die( $db->error );
}

$numPageRows = $result -> num_rows;

?>

<body>

<h2 class="text-center">
ข้อมูลนักศึกษา (จำนวน <?php echo $numRows;?> คน)
</h2>

<div class="container">
<table class="table mt-4 table-striped">
<thead>
<tr class="table-info">
<th>รหัสนักศึกษา</th>
<th>ชื่อ นามสกุล</th>
<th>Email</th>
<th>เบอร์ติดต่อ</th>
<th>แผนก</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
for($i = 1 ; $i <= $numPageRows; $i++){
$row = $result->fetch_assoc();
?>
<tr>
<td><?php echo $row['student_id']; ?></td>
<td><?php echo $row['student_fullname']; ?></td>
<td><?php echo $row['student_email']; ?></td>
<td><?php echo $row['student_mobile']; ?></td>
<td><?php echo $row['major_title']; ?></td>
<td><a class="btn-sm btn-warning" href="updateForm.php?student=<?php echo base64_encode($row['student_id'])?>">Update</a></td>
<td><a class="btn-sm btn-danger" href="delete.php?student=<?php echo base64_encode($row['student_id'])?>">Delete</a></td>
</tr>
<?php } ?>
</tbody>
</table>

<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item <?php if( $page==1) echo "disabled";?>">
<a class="page-link" href="?page=<?php echo $page-1; ?>" aria-label="Previous">Previous
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php for($p = 1 ; $p<=$totalPage; $p++){?>
<li class="page-item <?php if( $page == $p ) { echo "active";}?>">
<a class="page-link" href="?page=<?php echo $p;?>"><?php echo $p;?></a></li>

<?php } ?>

<li class="page-item <?php if( $page == $totalPage ) echo "disabled";?>">
<a class="page-link" href="?page=<?php echo $page+1; ?>" aria-label="Next">next
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</ul>
</nav>


<h4 class="text-center mt-3">
<a href="insertForm.php">เพิ่มข้อมูล</a>
</h4>

</div>




<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.