Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.   $servername = "localhost";
  3.   $username = "root";
  4.   $pass = "pass";
  5.   $dbName = "SheetPal";
  6.   $conn = mysqli_connect($servername , $username , $pass , $dbName);
  7.  
  8.   if(!$conn){
  9.     die("Connection failed: " . mysqli_connect_error());
  10.   }
  11.   else{
  12.     if( !$getWeek = $conn->prepare("SELECT date,task,paycode,starttime,finishtime,breaks,totalhours,comments FROM shifts") ){
  13.       echo "Getweek prepare failed: (" . $conn->error . ")";
  14.     }
  15.     else{
  16.       $getWeek->execute();
  17.       if( !$getWeek->bind_result($date, $task, $paycode, $starttime, $finishtime, $breaks, $totalhours, $comments) ){
  18.         echo "Getweek bind results failed: (" . $getWeek->errno . ") " . $getWeek->error;
  19.       }
  20.       else{
  21.         $shift = array();
  22.         echo $getWeek->fetch();
  23. //         while($getWeek->fetch()) {
  24. //           array_push($shift, $date, $task, $paycode, $starttime, $finishtime, $breaks, $totalhours, $comments);
  25. //         }
  26.       }
  27.     }
  28.   }
  29.  
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement