Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /***
- update koneksi dibawah!!
- ***/
- if(is_file('koneksi.php')){
- include'koneksi.php';
- }
- ?>
- <html>
- <head></head>
- <body>
- <table border="1">
- <thead align="center">
- <tr>
- <th>Hasil</th>
- <?php
- for($j=0;$j<10;$j++){
- echo "<th>$j</th>";
- }
- ?>
- </tr>
- </thead>
- <?php
- for($i=0;$i<10;$i++){
- echo '<tr>';
- $n=$i/100;
- echo '<td>'.$n.'</td>';
- for($j=0;$j<10;$j++){
- $n=($i*10+$j)/100;
- echo "<td>".get_num($n)."</td>";
- }
- echo '</tr>';
- }
- /**
- stat($i);
- $N1=floor($i*10)/10;
- $N2=floor($i*100)%10;
- mysqli_select_db($koneksi,"tabelz");
- $query="SELECT z".$N1." as num from tabelZ where noZ='$N1'";
- $sql=mysqli_query($query);
- $total=mysqli_num_rows($sql);
- while($data=mysqli_fetch_array($sql))
- {
- ?>
- <tbody>
- <tr>
- <td><?php echo $data['num'];?></td
- </tr>
- <?php }
- */
- ?>
- </tbody>
- </table>
- </body>
- </body>
- </html>
- <?php
- function get_num($i){
- $mysqli = koneksi();
- $N1=floor($i*10)/10;
- $N2=floor($i*100)%10;
- //mysqli_select_db($koneksi,"tabelz");
- $query="SELECT z".$N2." as num from tabelZ where noZ='$N1'";
- //$sql=mysqli_query($query);
- if($result= $mysqli->query($query)){
- $row = $result->fetch_array();
- }else{
- $row=array('num'=>$query);
- }
- return $row['num'];
- }
- function koneksi(){
- //update ini
- $mysqli = new mysqli("localhost", "root3", "", "fb_statistik");
- if(mysqli_connect_errno()){
- echo 'Gagal melakukan koneksi ke Database : '.mysqli_connect_error();
- exit;
- }
- return $mysqli;
- }
Advertisement
Add Comment
Please, Sign In to add comment